Skip to content

[BUG] [v0.0.7] cortex cache show --json exposes "cache_dir" as a flat string while cortex debug paths --json exposes "cache_dir" as a nested object with "path" and "exists" — same field name, incompatible types #53519

@tryeverything24

Description

@tryeverything24

Project

cortex

Description

Two commands both expose a "cache_dir" field but with entirely different types:

  • cache show --json"cache_dir": "/home/ubuntu/.cache/cortex" (flat string)
  • debug paths --json"cache_dir": {"path": "/home/ubuntu/.cortex/cache", "exists": false} (nested object)

A script reading "cache_dir" from either command gets a different type and must use different access patterns.

Error Message

Debug Logs

System Information

Cortex CLI v0.0.7
OS: Linux (Ubuntu)

Screenshots

https://github.com/tryeverything24/rawimagespublic/blob/main/23.png

Steps to Reproduce

Step 1: Check cache_dir in cache show JSON

cortex cache show --json | python3 -c "import json,sys; d=json.load(sys.stdin); print('cache show cache_dir:', d['cache_dir'], '| type:', type(d['cache_dir']).name)"

Output:

cache show cache_dir: /home/ubuntu/.cache/cortex | type: str

Step 2: Check cache_dir in debug paths JSON

cortex debug paths --json | python3 -c "import json,sys; d=json.load(sys.stdin); print('debug paths cache_dir:', d['cache_dir'], '| type:', type(d['cache_dir']).name)"

Output:

debug paths cache_dir: {'path': '/home/ubuntu/.cortex/cache', 'exists': False} | type: dict

Expected Behavior

Both commands should use the same type for "cache_dir". The richer nested object ({"path": "...", "exists": ...}) from debug paths is more informative and should be used consistently.

Actual Behavior

cache show cache_dir: /home/ubuntu/.cache/cortex | type: str
debug paths cache_dir: {'path': '/home/ubuntu/.cortex/cache', 'exists': False} | type: dict

cache show exposes "cache_dir" as a plain string while debug paths exposes it as a nested object. Accessing d["cache_dir"] returns incompatible types across the two commands.

Additional Context

Relevant source code:

  • cache show --json (src/cortex-cli/src/cache_cmd.rs): CacheStats struct has cache_dir: String — serializes as a plain string.

  • debug paths --json (src/cortex-cli/src/debug_cmd/types.rs): PathEntry struct has path: PathBuf and exists: bool — serializes as a nested object {"path": "...", "exists": ...}.

Both commands expose the cache directory but as different types. Note also that the actual paths differ (/home/ubuntu/.cache/cortex vs /home/ubuntu/.cortex/cache), pointing to a deeper inconsistency in which cache directory each command reports.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingideIssues related to IDEvalidValid issue

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions