Error codes

JSON-RPC errors return:

{
  "jsonrpc": "2.0",
  "id": <request id>,
  "error": {
    "code": -32601,
    "message": "method not found: fs.banana"
  }
}

(The spec reserves an optional data field too, but the current daemon never populates it — see Error data field below.)

Standard JSON-RPC errors (-32700 to -32600)

CodeNameWhen
-32700ParseErrorJSON parse failure
-32600InvalidRequestMalformed JSON-RPC envelope
-32601MethodNotFoundUnknown method name
-32602InvalidParamsParams don’t match method signature
-32603InternalErrorUnexpected server error

Authentication errors (-32000, -32001)

CodeNameWhen
-32000AuthRequiredNon-auth method called before authentication
-32001AuthInvalidWrong token in auth call (closes connection)

Filesystem errors (-32010 to -32015)

CodeNameWhen
-32010FileNotFoundPath does not exist
-32011NotADirectoryfs.list / fs.rmdir target is a file
-32012IsADirectoryFile-only operation on directory
-32013ExistsCreate-like op found path already present
-32014PermissionDeniedOS rejected operation (mode, quota, etc.)
-32015PathOutsideVaultResolved path escapes vault root

PathOutsideVault is the rejection for .., leading /, or absolute paths. The check resolves symlinks before matching, so a symlink targeting /etc/passwd cannot escape.

Concurrency / preconditions (-32020, -32021)

CodeNameWhen
-32020PreconditionFailedexpectedMtime did not match current; conflict
-32021ProtocolVersionTooOldserver.info returned incompatible version

PreconditionFailed is the foundation of conflict handling — clients optimistically try fs.write with their last-known mtime; the daemon rejects the write if someone else modified the file in between, and the client surfaces a resolution UI.

Error data field

The JSON-RPC error envelope reserves a data field, but the current daemon always sets it to nil — and the Go encoder uses omitempty, so the field is omitted from the wire entirely. Path / OS-level context is embedded in the error’s message string instead. Treat data as reserved for future use; do not parse it.

Clients should map error code to localized strings, not match on the message text.

Next: Security — threat model.