[GH-ISSUE #1765] SingleFile integration not working when using S3 to store assets. #1097

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

Originally created by @javydekoning on GitHub (Jul 23, 2025).
Original GitHub issue: https://github.com/karakeep-app/karakeep/issues/1765

Describe the Bug

If you use the default naming template in SingleFile with s3 storage enabled in Karakeep, the s3 API doesn't accept the upload.

Getting the following error:

<-- POST /api/v1/bookmarks/singlefile
An error was encountered in a non-retryable streaming request.
TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["x-amz-meta-x-amz-meta-file-name"]
    at ClientRequest.setHeader (node:_http_outgoing:703:3)
    at new ClientRequest (node:_http_client:302:14)
    at request (node:https:381:10)
    at /app/node_modules/@smithy/node-http-handler/dist-cjs/index.js:366:19
    at new Promise (<anonymous>)
    at _NodeHttpHandler.handle (/app/node_modules/@smithy/node-http-handler/dist-cjs/index.js:300:12)
    at /app/node_modules/@smithy/smithy-client/dist-cjs/index.js:155:35
    at /app/node_modules/@aws-sdk/middleware-flexible-checksums/dist-cjs/index.js:456:24
    at /app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/index.js:539:24
    at /app/node_modules/@smithy/middleware-serde/dist-cjs/index.js:34:30 {
  code: 'ERR_INVALID_CHAR'
}
--> POST /api/v1/bookmarks/singlefile 500 133ms
[Error: ENOENT: no such file or directory, open '/tmp/karakeep-upload-1753294884955'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/tmp/karakeep-upload-1753294884955'
}

Steps to Reproduce

  1. Setup Amazon S3 as the backend.
  2. Use Singlefile API integration to store anything in Karakeep.

Expected Behaviour

It should not error

Screenshots or Additional Context

No response

Device Details

No response

Exact Karakeep Version

v0.26.0

Have you checked the troubleshooting guide?

  • I have checked the troubleshooting guide and I haven't found a solution to my problem

Workaround

Change the naming template in SingleFile settings to: {date-iso}.{filename-extension} that works fine

Originally created by @javydekoning on GitHub (Jul 23, 2025). Original GitHub issue: https://github.com/karakeep-app/karakeep/issues/1765 ### Describe the Bug If you use the default naming template in SingleFile with s3 storage enabled in Karakeep, the s3 API doesn't accept the upload. Getting the following error: ```txt <-- POST /api/v1/bookmarks/singlefile An error was encountered in a non-retryable streaming request. TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["x-amz-meta-x-amz-meta-file-name"] at ClientRequest.setHeader (node:_http_outgoing:703:3) at new ClientRequest (node:_http_client:302:14) at request (node:https:381:10) at /app/node_modules/@smithy/node-http-handler/dist-cjs/index.js:366:19 at new Promise (<anonymous>) at _NodeHttpHandler.handle (/app/node_modules/@smithy/node-http-handler/dist-cjs/index.js:300:12) at /app/node_modules/@smithy/smithy-client/dist-cjs/index.js:155:35 at /app/node_modules/@aws-sdk/middleware-flexible-checksums/dist-cjs/index.js:456:24 at /app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/index.js:539:24 at /app/node_modules/@smithy/middleware-serde/dist-cjs/index.js:34:30 { code: 'ERR_INVALID_CHAR' } --> POST /api/v1/bookmarks/singlefile 500 133ms [Error: ENOENT: no such file or directory, open '/tmp/karakeep-upload-1753294884955'] { errno: -2, code: 'ENOENT', syscall: 'open', path: '/tmp/karakeep-upload-1753294884955' } ``` ### Steps to Reproduce 1. Setup Amazon S3 as the backend. 2. Use Singlefile API integration to store anything in Karakeep. ### Expected Behaviour It should not error ### Screenshots or Additional Context _No response_ ### Device Details _No response_ ### Exact Karakeep Version v0.26.0 ### Have you checked the troubleshooting guide? - [x] I have checked the troubleshooting guide and I haven't found a solution to my problem ## Workaround Change the naming template in SingleFile settings to: `{date-iso}.{filename-extension}` that works fine
kerem 2026-03-02 11:54:58 +03:00
Author
Owner

@javydekoning commented on GitHub (Jul 23, 2025):

Looks like the header is wrong x-amz-meta-x-amz-meta? x-amz-meta is prepended twice. However, that doesn't explain the issue to me.

The ENOENT error might be a race condition, it is being deleted here https://github.com/karakeep-app/karakeep/blob/main/packages/shared/assetdb.ts#L382

Instead, you could let the caller handle it after: https://github.com/karakeep-app/karakeep/blob/main/packages/api/utils/upload.ts#L106-L112

<!-- gh-comment-id:3109838122 --> @javydekoning commented on GitHub (Jul 23, 2025): Looks like the header is wrong `x-amz-meta-x-amz-meta`? `x-amz-meta` is prepended twice. However, that doesn't explain the issue to me. The ENOENT error might be a race condition, it is being deleted here https://github.com/karakeep-app/karakeep/blob/main/packages/shared/assetdb.ts#L382 Instead, you could let the caller handle it after: https://github.com/karakeep-app/karakeep/blob/main/packages/api/utils/upload.ts#L106-L112
Author
Owner

@iSwiftLiu commented on GitHub (Aug 9, 2025):

same issue

<!-- gh-comment-id:3170540597 --> @iSwiftLiu commented on GitHub (Aug 9, 2025): same issue
Author
Owner

@MohamedBassem commented on GitHub (Aug 22, 2025):

Fixed in github.com/karakeep-app/karakeep@39a650f634. Coming in the next release.

<!-- gh-comment-id:3215290530 --> @MohamedBassem commented on GitHub (Aug 22, 2025): Fixed in https://github.com/karakeep-app/karakeep/commit/39a650f63484fd8bc982311622c91ad03109547a. Coming in the next release.
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#1097
No description provided.