Skip to content

[Bug]: openviking plugin — viking_read returns 500 for file URIs on abstract/overview levels #12755

@pty819

Description

@pty819

Bug Description

The viking_read tool in the openviking memory plugin returns HTTP 500 when reading file URIs at abstract or overview detail levels.

Root cause confirmed by API testing:

  • /api/v1/content/abstract — only accepts directory URIs → file URIs return {"error": {"code": "INTERNAL"}}
  • /api/v1/content/overview — only accepts directory URIs → file URIs return {"error": {"code": "INTERNAL"}}
  • /api/v1/content/download — only accepts file URIs → directory URIs return a non-JSON response

The plugin routes ALL URIs through abstract and overview regardless of type, but these endpoints are directory-only. File content must go through /api/v1/content/download.

Steps to Reproduce

{
  "uri": "viking://user/default/memories/events/mem_cf3e006a-5cdf-4680-b8ec-aa9cf3676426.md",
  "level": "abstract"
}

Expected: ~100 token abstract of the file
Actual: 500 Internal Server Error

Verified API Behavior

Endpoint Directory URI File URI
GET /content/abstract ✅ 200 OK ❌ 500 INTERNAL
GET /content/overview ✅ 200 OK ❌ 500 INTERNAL
GET /content/download ❌ non-JSON ✅ 200 (raw content)

Code Location

plugins/memory/openviking/__init__.py, _tool_read() lines 573–599:

if level == "abstract":
    resp = self._client.get("/api/v1/content/abstract", params={"uri": uri})  # ← directory-only
elif level == "full":
    resp = self._client.get("/api/v1/content/read", params={"uri": uri})
else:  # overview
    resp = self._client.get("/api/v1/content/overview", params={"uri": uri})  # ← directory-only

Fix

Before calling an endpoint, determine URI type via fs/stat (isDir field), then route:

  • file/api/v1/content/download
  • directory + abstract/api/v1/content/abstract
  • directory + overview/api/v1/content/overview

Or migrate to the official SDK which handles this dispatch internally.

Environment

  • openviking server: 0.3.9
  • hermes-agent plugin: openviking 2.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions