Skip to content

docs(api): v2 detail error object, FILE_NOT_FOUND, total vs row_count, 400/422 and async create codes (OSS-138, ENG-5709) - #414

Open
adityamishra-hydradb wants to merge 2 commits into
mainfrom
adityamishra/oss-138-v2-error-detail-row-count
Open

adityamishra-hydradb wants to merge 2 commits into
mainfrom
adityamishra/oss-138-v2-error-detail-row-count

Conversation

@adityamishra-hydradb

@adityamishra-hydradb adityamishra-hydradb commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

For humans

Fixes OSS-138 and closes ENG-5709: docs only, codes unchanged (user decision).

The v2 docs now match what prod returns today:

  1. detail error object. Every v2 error has a top-level detail object. It is a deprecated copy of error (error_code, message, success: false). The v2 error page now shows it in the example and in a table, and tells readers to use error. The page also lists meta.api_version, which every error carries.
  2. FILE_NOT_FOUND. Added to the ingestion codes table on the error page. GET /context/status returns it for an ID that is not in the database and collection. The status is errored, but no indexing failed.
  3. row_count vs total. database-stats already said that row_count counts chunks. list-context now says that total counts sources, so row_count can be larger.
  4. 400 vs 422 (ENG-5709). A missing or invalid field usually returns 400 INVALID_INPUT. GET /context/status is the exception: 422 VALIDATION_ERROR for a missing database or ID. The source-status page already said this.
  5. Async create and delete (ENG-5709). POST /databases returns 200 with status: "accepted". Ingest and delete return 202. The create page now says this. The delete page said a repeat delete "returns 200 again". Prod returns 202, so the page now says 202.

No API change. The OpenAPI spec already had 200 for create and 422 for status.

For agents

  • Files: api-reference/v2/error-responses.mdx, api-reference/v2/endpoint/list-context.mdx, api-reference/v2/endpoint/create-database.mdx, api-reference/v2/endpoint/delete-database.mdx.
  • vale-spellcheck is neutral on delete-database.mdx:70 ("deregistration"). That line is unchanged by this PR, and the word is correct.
  • Not changed, already correct on main: database-stats.mdx ("row_count counts chunks, not sources") and source-status.mdx (FILE_NOT_FOUND row, 422 for a missing database or ID). The ticket said these were missing. They were not.
  • Decision for detail: option A from the ticket (document it as deprecated). This matches the app source: application/internal/api/handler/errors.go calls detail "the deprecated legacy error object".
  • Not in the docs: hydradb-application PR 4554 adds a database-wide row_count and type to /databases/stats, and fixes the double count on unified databases. It is open and not deployed, so this PR does not document it.
  • Open docs PRs on the same files. This PR does not change their lines:
    • docs PR 411: error page status table (429 row), code table (RATE_LIMITED), retry paragraph.
    • docs PR 398: error page envelope intro and code table rows. list-context lines 169 and 190.
    • docs PR 390: error page Python example and 401 troubleshooting.
    • docs PR 393 and docs PR 394: create-database line 116, list-context front matter, error page line 217.
    • docs PR 409, docs PR 407 and docs PR 408 do not touch these files. 409 must merge before 407 and 408. This PR can merge in any order.
    • Follow-up: the generic 422 row in the status table still says "Well-formed request that failed validation". This PR does not reword it, because 411 changes the next line. The new paragraph under the code table gives the exact rule.

Proof

A = base main @ efa6f55 / B = this PR @ 3a1ba84 (final head). Docs only. The API is the same for A and B. Prod (test org) was checked on 2026-12-04 between 18:31 and 18:53 UTC. The throwaway databases dogfood-oss138-rc and dogfood-oss138-create were deleted after the runs.

1. A/B on the real repro: the docs against prod

What prod returns (request_id) A (base @efa6f55) B (PR @3a1ba84)
Every error has detail = copy of error, success: false: 404 DATABASE_NOT_FOUND (a27e7c12-ada3-4e18-b4c9-43cb5dbf2930), 401 UNAUTHORIZED (3bc3fe40-f10b-4074-ac24-cc0418a0c3a8), 422 VALIDATION_ERROR (db0e0e39-2baa-42f7-8aa3-ef98d40099f4), 400 INVALID_INPUT (9d5cf09c-afbd-4d06-81b0-f6825878b54c) detail.error_code 0 mentions example + table + "deprecated, read error"
Every error meta has api_version: "2.0.1" (same 4 requests) 0 mentions example + table row
GET /context/status unknown ID -> 200, errored, FILE_NOT_FOUND, message: "ID not found" (cdf7031f-8d2a-4358-a338-09c2f8e87d0a) error page: 0 mentions row in "Ingestion error codes"
Split DB, 1 long + 1 short document, 1 memory: stats row_count knowledge 41 / memory 1 (5d517e97-9689-4b0e-818a-d586b05155d3); /context/list total knowledge 2 (88bacafd-605d-40bd-a379-8e3e8ac27130) / memory 1 (62f84d3a-1354-45f2-9bdd-0c1527d0df23) list-context: no definition of total "total counts sources, not chunks"
GET /context/status no ID -> 422 (d559c526-52bb-4a70-8e78-307465558593); no database -> 422 (17e888f1-45a5-4711-adb5-6b20490216d9). Missing field on /query, /context/list, /context/ingest, /databases/stats, POST /databases -> 400 INVALID_INPUT (1f1d4369-…, 9b03931f-…, 954774e3-…, c86ae4b7-…, 83e855be-…, e5a24a38-…) error page: no rule "usually 400; /context/status returns 422"
POST /databases -> 200 accepted (d2bb98d3-aedf-4679-ad2f-0a8f652724d3) create page: no status code "returns HTTP 200 … ingest and delete return 202"
DELETE /databases -> 202 deletion_scheduled, repeat call -> 202 again (121e301a-497c-4121-b15c-de1346dfaa5c, 755baec1-80a9-4d79-9aeb-2178ba2e9602) delete page: "still deleting returns 200 again" (wrong) "returns 202 … returns 202 again"

Text check (git show <sha>:<file> | grep -c):

Check A (base @efa6f55) B (PR @3a1ba84)
detail.error_code on the error page 0 1
FILE_NOT_FOUND on the error page 0 1
api_version on the error page 0 2
422 exception sentence 0 1
list-context "count the sources" 0 1
create-database "returns HTTP 200" 0 1
delete-database "still deleting returns 200" (wrong) 1 0

Rendered pages (A = docs.hydradb.com, B = this PR's Mintlify preview):

A — base main @efa6f55 / B — PR @3a1ba84 — error envelope and the detail object

A — base main @efa6f55 / B — PR @3a1ba84 — ingestion error codes with FILE_NOT_FOUND

2. Regression (the CI docs gates, run locally on B, Python 3.12)

Gate B (PR @3a1ba84)
.github/verify_v2_public_contract.py OK: 53 V2 pages, 44 endpoint bindings, 87 JSON examples (the new example with detail validates against the schema)
scripts/test_docs_consistency.py OK
unittest discover -s scripts 42 tests OK (1 skipped)
verify_agents_endpoints.py OK, 54 mentions
generate_llms_index.py --check OK
CI validate, hygiene, dco-check, link-rot all green; vale neutral (see above)

3. Smoke

The Mintlify preview renders both new sections, and the "On this page" list shows "The detail object" (images above).

4. Stress

N/A — docs only.

5. Edge cases

  • detail on 4 status classes (400, 401, 404, 422): same 3 fields each time.
  • Memory store: row_count 1 = total 1, so the "can be larger" wording holds for both stores.

Raw outputs: ~/hydradb/dogfood/docs-sdk/proof/oss138/ (errors-run1.txt, rowcount-run1.txt, rowcount-run2.txt, validation-run1.txt, cleanup-and-create.txt, docs-grep-ab.txt).

🤖 Generated with Claude Code

… row_count, and 400/422 + 200 create (OSS-138, ENG-5709)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: adityamishra-hydradb <[email protected]>
@adityamishra-hydradb

Copy link
Copy Markdown
Contributor Author

@hydra-mira-review review

@adityamishra-hydradb

Copy link
Copy Markdown
Contributor Author

/devin review

@mintlify

mintlify Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
cortex-ai 🟢 Ready View Preview Dec 4, 2026, 6:53 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Starting Devin Review.

Devin Review

@hydra-mira-review

hydra-mira-review Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Mira score 5/5 · 🟢 Good to merge

  • No findings, nothing missing outside this PR, and no high-risk change.

API users get clearer documentation for errors, record counts, and asynchronous database operations. This PR updates four documentation pages without changing API behavior.

How this PR works · 5 changes, 5 low risk

API readers need accurate guidance on error fields, source counts, and asynchronous response codes. This PR documents existing v2 responses and corrects the deletion retry status. It changes documentation only; API behavior and response codes remain unchanged.

1. Document the deprecated error copy and API version · 🟢 low risk · api-reference/v2/error-responses.mdx

Readers now see the legacy error fields and API version. The example and tables add detail and meta.api_version, while directing new clients to read error.

Risk: Incorrect field guidance would cause client authors to parse errors incorrectly or depend on deprecated fields.

Check:

  • Confirm the shared error handler supplies the documented detail fields and meta.api_version.

In error-responses.mdx:20-54.

2. Explain the status endpoint's validation exception · 🟢 low risk · api-reference/v2/error-responses.mdx

Readers now see why missing fields can return different statuses. The paragraph contrasts the usual 400 INVALID_INPUT with missing database or ID errors from GET /context/status.

Risk: Incorrect guidance would cause clients to mishandle missing-field errors from status requests.

Check:

  • Compare the new paragraph with the missing-field cases in source-status.mdx under Errors.

In error-responses.mdx:97.

3. Distinguish missing sources from failed ingestion · 🟢 low risk · api-reference/v2/error-responses.mdx

Readers can distinguish an unknown source from an indexing failure. The table adds FILE_NOT_FOUND, explains its errored status, and removes the numeric-only description of ingestion codes.

Risk: Incorrect guidance would cause operators to treat a wrong ID or scope as a failed ingestion.

Check:

  • Compare the new row with the unknown-ID example and error-code table in source-status.mdx.

In error-responses.mdx:105-116.

4. Clarify that list totals count sources rather than chunks · 🟢 low risk · api-reference/v2/endpoint/list-context.mdx

Readers now know why source totals can be smaller than database row counts. The added paragraph says total and pagination.total count matching sources or memories, while row_count counts chunks.

Risk: Incorrect counting guidance would cause users to report missing sources or calculate usage incorrectly.

Check:

  • Confirm the explanation agrees with the chunk-count guidance in database-stats.mdx.

In list-context.mdx:156.

5. Clarify asynchronous create and delete response codes · 🟢 low risk · api-reference/v2/endpoint/create-database.mdx +1

Readers now get explicit acceptance codes for asynchronous operations. Creation documents 200 with accepted; deletion documents 202 with deletion_scheduled and changes the repeated-deletion guidance from 200 to 202.

Risk: Incorrect guidance would cause clients to reject successful responses or start ingestion before a database is ready.

Check:

  • Confirm repeated deletion during cleanup returns 202; the OpenAPI definition lists both 200 and 202.

In create-database.mdx:11, delete-database.mdx:66-72.

Requirement check · 6 met · from the PR description
  • ✅ Keep API behavior and response codes unchanged (met). All changes are confined to the four documentation pages.
  • ✅ Document the deprecated error copy and the API version field (met). error-responses.mdx adds both fields, maps the legacy fields, and directs new clients to error.
  • ✅ Explain that FILE_NOT_FOUND means the requested source was absent, rather than indexing having failed (met). error-responses.mdx adds the scoped lookup explanation and errored status; source-status.mdx already documents the same case.
  • ✅ Explain source totals versus chunk counts (met). list-context.mdx defines both totals as source counts; database-stats.mdx already defines row_count as chunks.
  • ✅ Explain the usual 400 validation response and the status endpoint's 422 exception (met). error-responses.mdx adds the rule for missing database or source ID, matching the Errors section in source-status.mdx.
  • ✅ Document asynchronous creation as 200 with accepted, while ingestion and deletion return 202 (met). create-database.mdx states the distinction; delete-database.mdx explicitly documents 202 for initial and repeated deletion.
Check by hand · 1
  • Confirm that repeated DELETE /databases requests during deletion return 202; api-reference/v2/openapi.json documents both 200 and 202 without identifying that case.

Comment @hydra-mira-review help for commands.

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

✅ Mintlify Hygiene

No issues found.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: adityamishra-hydradb <[email protected]>
@adityamishra-hydradb

Copy link
Copy Markdown
Contributor Author

@hydra-mira-review review

@adityamishra-hydradb

Copy link
Copy Markdown
Contributor Author

/devin review

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Starting Devin Review.

Devin Review

adityamishra-hydradb added a commit that referenced this pull request Dec 4, 2026
Signed-off-by: adityamishra-hydradb <[email protected]>

This branch was successfully deployed

1 active deployment
staging — 3a1ba84c Deployed Dec 4, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant