Skip to content

Misleading NOT_FOUND error when accessing resource under different account namespace #1705

@SonicBotMan

Description

@SonicBotMan

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

  1. Configure OpenViking with account wiki in ov.conf or config
  2. Store data under viking://wiki/user/wiki-user/resources/docs/myfile.md
  3. 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"}'
  4. 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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions