Skip to content

API: Cannot delete documents with slashes in 'document_id' (404 Not Found) #92

Description

@j2h4u

Describe the bug
I cannot delete a document if its document_id contains a forward slash (/), even though such documents can be created via retain and appear in listDocuments.

To Reproduce

  1. Create a memory with a path-like ID:
    POST /v1/default/banks/test/memories
    {
      "content": "test",
      "document_id": "folder/file.md"
    }
  2. Verify it exists via GET /v1/default/banks/test/documents (it returns id: "folder/file.md").
  3. Try to delete it via DELETE /v1/default/banks/test/documents/{document_id}:
    • Raw: DELETE .../documents/folder/file.md -> 404 Not Found (Router mismatch)
    • Encoded: DELETE .../documents/folder%2Ffile.md -> 404 Not Found (Router mismatch)
    • Double Encoded: DELETE .../documents/folder%252Ffile.md -> 404 Document not found (App logic mismatch)

Expected behavior
The API should accept encoded slashes in the document_id path parameter and correctly resolve them to the stored ID, allowing deletion.

Context

  • Hindsight Version: (Latest Docker image)
  • Client: Custom CLI using generated TypeScript SDK.
  • Impact: Forces clients to use ID encoding strategies (like Base64URL) to work around the API limitation for file-based synchronization, and prevents cleanup of existing legacy documents.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions