CLI: `bookmarks add` exits 0 when some links fail, and `--json` output is followed by non-JSON lines
Environment
- karakeep CLI (npm
karakeep), self-hosted server - Bulk import of ~55k bookmarks via repeated
karakeep bookmarks add --link ... (x100)
1. Partial failures exit 0
When some links in a batch fail, the command still exits 0 and prints the failure to stdout:
Error: Failed to add a link bookmark for url "https://example.com/page". Reason: database is lockedA caller that checks the exit code sees success. In a 300-batch import this hid 11 lost URLs until the tag counts were reconciled by hand.
Expected: non-zero exit when at least one link fails (or an opt-in flag such as --fail-on-error), and failures on stderr rather than stdout.
2. --json output is not valid JSON
karakeep --json bookmarks add --tag-name X --link ... prints the JSON array, then appends lines like:
Success: Added the tag X to the bookmark with id abcdefJSON.parse / json.load on the whole stdout fails with "Extra data". The same happens for --json bookmarks list. Workaround is a streaming/partial decode of the leading value.
Expected: with --json, stdout carries only the JSON document; human-readable progress goes to stderr.
Happy to send a PR if the maintainers agree on the shape (exit code vs flag).
sid: 2HHPLS
Source: karakeep-app/karakeep