[GH-ISSUE #109] TRPCClientError on import #92

Closed
opened 2026-03-02 11:46:30 +03:00 by kerem · 3 comments
Owner

Originally created by @rorymurtagh on GitHub (Apr 18, 2024).
Original GitHub issue: https://github.com/karakeep-app/karakeep/issues/109

When I try to import I always get the same error and the import fails.

For example:
docker run --rm ghcr.io/mohamedbassem/hoarder-cli:release --api-key --server-addr http://localhost:3000 bookmarks add --link "https://www.google.com"

Gives:
Error: TRPCClientError: Unexpected token '<', "<html>
<h"... is not valid JSON

Hoping it's something I'm doing that is wrong. Thanks!

Originally created by @rorymurtagh on GitHub (Apr 18, 2024). Original GitHub issue: https://github.com/karakeep-app/karakeep/issues/109 When I try to import I always get the same error and the import fails. For example: docker run --rm ghcr.io/mohamedbassem/hoarder-cli:release --api-key <my api key> --server-addr http://localhost:3000 bookmarks add --link "https://www.google.com" Gives: Error: TRPCClientError: Unexpected token '<', "<html> <h"... is not valid JSON Hoping it's something I'm doing that is wrong. Thanks!
kerem 2026-03-02 11:46:30 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@MohamedBassem commented on GitHub (Apr 18, 2024):

Hi, this is a quirk of docker. If you want to import to localhost, the localhost of the container is different than that of the host. Adding --net=host should solve it I guess. I think you can also get it to work by replacing localhost with host.docker.internal so --server-addr http://host.docker.internal:3000/

EDIT: to clarify, the --net=host should be added after docker run not as an argument to the CLI.

<!-- gh-comment-id:2065067587 --> @MohamedBassem commented on GitHub (Apr 18, 2024): Hi, this is a quirk of docker. If you want to import to `localhost`, the localhost of the container is different than that of the host. Adding `--net=host` should solve it I guess. I **think** you can also get it to work by replacing `localhost` with `host.docker.internal` so `--server-addr http://host.docker.internal:3000/` EDIT: to clarify, the `--net=host` should be added after `docker run` not as an argument to the CLI.
Author
Owner

@rorymurtagh commented on GitHub (Apr 18, 2024):

"--net=host" made it work. Thank you!!

<!-- gh-comment-id:2065082861 --> @rorymurtagh commented on GitHub (Apr 18, 2024): "--net=host" made it work. Thank you!!
Author
Owner

@MohamedBassem commented on GitHub (Apr 18, 2024):

Perfect!

<!-- gh-comment-id:2065090460 --> @MohamedBassem commented on GitHub (Apr 18, 2024): Perfect!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/karakeep#92
No description provided.