Skip to content

Web UI 'save note' fails 422 — JS sends {query, markdown} but backend expects {filename, content} #7

@dolilod

Description

@dolilod

Repro

Tested on enzyme v0.5.3 (macos-arm64).

  1. enzyme serve -p <vault> (any vault)
  2. Open http://127.0.0.1:8765/ in browser
  3. Use the UI's note-save feature → fails with HTTP 422

Root cause

Frontend/backend payload mismatch.

JS bundle (/assets/index-C3fkMwYV.js) sends:

fetch(`${baseURL}/notes/save`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ query: S, markdown: c })
})

Rust backend (/notes/save route) expects:

{ "filename": "<path>", "content": "<markdown body>" }

Server response on the JS-shaped payload:

HTTP 422 Unprocessable Entity
Failed to deserialize the JSON body into the target type: missing field `filename`

Confirmed working when manually shaped correctly

curl -X POST http://127.0.0.1:8765/notes/save \
  -H "Content-Type: application/json" \
  -d '{"filename":"00-Inbox/test.md","content":"# Test"}'
# → HTTP 200, {"file_path":"...","relative_path":"...","success":true}
# → file actually created in vault

So the backend save logic is fine. Just the frontend asset sends wrong field names.

Fix (one-line in JS source pre-bundle)

- body: JSON.stringify({ query: S, markdown: c })
+ body: JSON.stringify({ filename: S, content: c })

Or update the backend to accept both field names for backward compat.

Reference

JS source location (from binary string): crates/enzyme-api/src/explore_pipeline.rs references /notes/save route. The frontend that ships with the binary is at /assets/index-C3fkMwYV.js.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions