You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ApiError::query returns 500 for caller errors: audit its callers onto invalid_query #1908
ApiError::query(msg) (fluree-db-api/src/error.rs) builds ApiError::Internal("Query error: …"), which both ApiError::status_code() and the server's ServerError::status_code() map to 500. Despite the name, it's used mostly for errors caused by the caller: a bad selector, an unknown graph, invalid options. Clients that retry on 5xx treat those as server faults, and so do operators watching err:system/InternalError.
#1896 added ApiError::invalid_query(msg) (QueryError::InvalidQuery, a 400). Only the new time-pin refusals use it so far, plus the dataset-spec parse errors, which #1897 moved over. There are still 79 ApiError::query( calls across 19 files in fluree-db-api/src. The largest groups:
File
Calls
query/connection.rs
14
policy_builder.rs
13
ledger_view.rs
9
query/builder.rs
8
view/query.rs, query/nameservice_builder.rs
4 each
Proposal
Audit each call site and sort it into one of two groups:
Caller errors → invalid_query (400): for example unknown named graph, missing ledger before #, and commit-prefix-not-found in time_resolve.
Then either delete ApiError::query or rename it, so the name no longer suggests a 400. Each converted site should get a status_code() assertion in its test.
Changing the constructor itself to a 400 in one step is tempting, but it would also turn any real internal failure among the callers into a 400. The audit is the point.
Activity
bplatz commentedon Sep 23, 2026
placeholder