Bug: Reindex API returns NOT_FOUND when using different account header
Description
When calling POST /api/v1/maintenance/reindex with an X-OpenViking-Account header that doesn't match the account where the data was stored, the API returns NOT_FOUND with no indication that the issue is a namespace/account mismatch.
This is confusing because "NOT_FOUND" implies the resource doesn't exist, when in fact it does exist — just under a different account namespace.
Steps to Reproduce
- Configure OpenViking with account
wiki in ov.conf or config
- Store data under
viking://wiki/user/wiki-user/resources/docs/myfile.md
- Call reindex API with a different account header:
curl -X POST http://localhost:1933/api/v1/maintenance/reindex \
-H "Authorization: Bearer <token>" \
-H "X-OpenViking-Account: hermes" \
-H "X-OpenViking-User: hermes-user" \
-H "Content-Type: application/json" \
-d '{"uri": "viking://wiki/user/wiki-user/resources/docs/myfile.md"}'
- Response:
{"error": "NOT_FOUND"}
Expected Behavior
The error message should distinguish between:
- Resource truly does not exist:
NOT_FOUND
- Resource exists under a different account: Something like
FORBIDDEN, WRONG_ACCOUNT, or at minimum a message like "Resource not found in account 'hermes'. It may exist under a different account."
Root Cause
In core/namespace.py, _resolve_user_uri() resolves URIs within the context of the current account. When the account doesn't match the URI prefix, the resource simply appears absent. The error propagates up as a generic NOT_FOUND from viking_fs.stat().
Environment
- OpenViking v0.3.10
- Docker deployment
Bug: Reindex API returns NOT_FOUND when using different account header
Description
When calling
POST /api/v1/maintenance/reindexwith anX-OpenViking-Accountheader that doesn't match the account where the data was stored, the API returnsNOT_FOUNDwith no indication that the issue is a namespace/account mismatch.This is confusing because "NOT_FOUND" implies the resource doesn't exist, when in fact it does exist — just under a different account namespace.
Steps to Reproduce
wikiinov.confor configviking://wiki/user/wiki-user/resources/docs/myfile.md{"error": "NOT_FOUND"}Expected Behavior
The error message should distinguish between:
NOT_FOUNDFORBIDDEN,WRONG_ACCOUNT, or at minimum a message like"Resource not found in account 'hermes'. It may exist under a different account."Root Cause
In
core/namespace.py,_resolve_user_uri()resolves URIs within the context of the current account. When the account doesn't match the URI prefix, the resource simply appears absent. The error propagates up as a genericNOT_FOUNDfromviking_fs.stat().Environment