fix: unexpected 'rm-filename' http header 400 error (add .docSchema extension when fetching document index in Mirror - fixes issue #62)#63
Conversation
BlobDoc.Mirror() was passing only the UUID as rm-filename header when fetching the document index blob. The API requires UUID.docSchema, consistent with how uploads already use addExt(doc.DocumentID, DocSchemaExt). Fixes status 400 on document blob fetches
bgeisel1
left a comment
There was a problem hiding this comment.
Hey @marcobarcelos! I'd recommend also applying the fix I've attached below as a diff. The blobdoc.go fixes the state where you already have the cache. But you have to also patch tree.go to catch cold start with no cache. New installs will go down this second path.
Hope that helps! With this change, I fully agree with this fix. I verified with blob GETs, put-to-folder works, etc.
diff --git a/api/sync15/tree.go b/api/sync15/tree.go
index 3e58c30..77cf190 100644
--- a/api/sync15/tree.go
+++ b/api/sync15/tree.go
@@ -374,7 +374,7 @@ func BuildTree(provider RemoteStorage) (*HashTree, error) {
tree.SchemaVersion = schema
for _, e := range entries {
- f, err := provider.GetReader(e.Hash, e.DocumentID)
+ f, err := provider.GetReader(e.Hash, addExt(e.DocumentID, archive.DocSchemaExt))
if err != nil {
return nil, fmt.Errorf("failed to read blob %s: %w", e.DocumentID, err)
}
To verify this you just have to reset the cache, right? |
|
Thanks @bgeisel1 , well observed. I applied the fix for cold start aswell (no cache). |
bgeisel1
left a comment
There was a problem hiding this comment.
LGTM! This random guy on the internet says we should merge it! :-)
Haha thanks. Just waiting for maintainer approval.
|
Actually, @Azeirah , it looks like I misread -- I dug in a little more and I think this is dead code. Maybe from starting to build an API to use this as a library or something a while ago. If it ever gets wired in, it'll need this fix. That being said, we could probably open another issue to delete it, but I don't have enough intent-understanding of the code to suggest it. I probably just diligently suggested fixing some dead code. :-( Thanks for being willing to test it! |
|
Confirming this fixes the cold-pair / fresh-device path on macOS arm64, May 2026. Specifically the Trace evidence lined up with the diagnosis: Would love to see this merged so I can point my install back at an upstream release rather than maintaining a local build. |
Thanks for confirming! Regarding the merge, I’m currently waiting for approval from adm. |
All operations that build the document tree fail with HTTP 400 and the message
{"message":"unexpected 'rm-filename' http header"}since reMarkable updated their API.The root cause:
BlobDoc.Mirror()was fetching each document's index blob withrm-filename: <uuid>, but the API now requiresrm-filename: <uuid>.docSchema.One-line change - use
addExt(e.DocumentID, archive.DocSchemaExt)when callingGetReader, consistent with how uploads already work throughoutapictx.go.Verified with
rmapi lsandrmapi putagainst the live reMarkable cloud API (May 2026).Fixes #62