Brief Description:
NOTE :: This defect was found and verified during the use of AI agents in an automated workflow.
The `obsidian move` CLI command exits with code `0` (success) even when the move operation fails. When the destination directory does not exist, the CLI prints an `Error: ENOENT` message to stdout but still returns exit code `0`. This makes it impossible for calling scripts to detect failures via standard shell error handling (`$?`, `set -e`, `||`).
Steps to reproduce:
Product: Obsidian CLI
Version: 1.12.4 (installer 1.12.4)
OS: macOS (Apple Silicon)
Prerequisites:
- Obsidian running with a vault open
- A file that exists in the vault (e.g.
test-note.md) - A destination path whose parent directory does not yet exist in the vault
Manual reproduction:
# From inside the vault directory
cd "/path/to/your/vault"
# Attempt to move a file to a non-existent subdirectory
obsidian move "path=test-note.md" "to=NonExistent/Subfolder"
# Check the exit code
echo "Exit code: $?"
### Did you follow the troubleshooting guide? \[Y\]
### Expected result
When a move operation fails (e.g. because the destination directory does not exist), the CLI should:
- Print the error message to stderr (not stdout)
- Exit with a non-zero exit code (e.g. 1) so that calling scripts can detect the failure via $?
### Actual result
The CLI prints the error to stdout, then exits with code 0: Instead of the expected result, what happened?
### Environment
Product: Obsidian CLI
Version: 1.12.4 (installer 1.12.4)
Hardware: macOS (Apple Silicon) 2.3 GHz 8-Core Intel Core i9
OS: Tahoe Version 26.3
Shell : zsh
---
### Additional information
Workaround (until fixed)
Ensure destination directories exist before calling obsidian move, and check stdout for the string "Error:" in addition to the exit code:
```mkdir -p "$VAULT_ROOT/$dest_dir"
result=$(obsidian move "path=$src" "to=$dest" 2>&1)
rc=$?
if (( rc != 0 )) || [[ "$result" == *"Error:"* ]]; then
echo "Move failed: $result"
fi```