Bug Description
The kb link and kb links bulk-create commands fail with Error: KB not found for a newly registered and indexed KB, even though kb search, kb get, kb list, and kb tags all work correctly for the same KB.
Steps to Reproduce
- Create a new KB directory with kb.yaml and entries
- Register it:
kb kb add /path/to/kb -n my-kb -t network-investigation -d "description"
- Index it:
kb kb reindex -k my-kb → succeeds, shows entries added
- Verify search works:
kb search "test" -k my-kb → succeeds, returns results
- Verify get works:
kb get entry-id -k my-kb → succeeds
- Try to create a link:
kb link source-id target-id -k my-kb -r related_to → fails with "KB not found"
- Try bulk links:
kb links bulk-create file.yaml -k my-kb → same error
- Also fails:
kb kb validate my-kb → "KB not found"
- Also fails:
kb orient -k my-kb → "KB not found"
Expected Behavior
All commands should find the KB consistently once it's registered and indexed.
Actual Behavior
Search index commands (search, get, tags, list-entries, reindex) work fine.
Link commands, validate, and orient all fail with "KB not found".
This suggests the link subsystem uses a different registry/DB lookup path than the search subsystem.
Environment
- Pyrite version: latest (as of 2026-04-03)
- KB type: network-investigation
- Entries: 106
- Registration method:
kb kb add followed by kb kb reindex
Workaround Attempted
Removed and re-added the KB — same result. The search index is correctly populated but the link/validate/orient subsystems can't find the KB.
Affected Commands
kb link ❌
kb links bulk-create ❌
kb kb validate ❌
kb orient ❌
kb search ✅
kb get ✅
kb tags ✅
kb list-entries ✅
kb kb reindex ✅
kb kb list ✅ (shows KB in registry)
Investigation Notes
The main Pyrite DB at ~/.pyrite/pyrite.db appears empty (.tables and .schema return nothing), while the search index is populated. The link system may be looking for entries in the main DB rather than the search index, and the main DB may not have been provisioned for this KB type.
Bug Description
The
kb linkandkb links bulk-createcommands fail withError: KB not foundfor a newly registered and indexed KB, even thoughkb search,kb get,kb list, andkb tagsall work correctly for the same KB.Steps to Reproduce
kb kb add /path/to/kb -n my-kb -t network-investigation -d "description"kb kb reindex -k my-kb→ succeeds, shows entries addedkb search "test" -k my-kb→ succeeds, returns resultskb get entry-id -k my-kb→ succeedskb link source-id target-id -k my-kb -r related_to→ fails with "KB not found"kb links bulk-create file.yaml -k my-kb→ same errorkb kb validate my-kb→ "KB not found"kb orient -k my-kb→ "KB not found"Expected Behavior
All commands should find the KB consistently once it's registered and indexed.
Actual Behavior
Search index commands (search, get, tags, list-entries, reindex) work fine.
Link commands, validate, and orient all fail with "KB not found".
This suggests the link subsystem uses a different registry/DB lookup path than the search subsystem.
Environment
kb kb addfollowed bykb kb reindexWorkaround Attempted
Removed and re-added the KB — same result. The search index is correctly populated but the link/validate/orient subsystems can't find the KB.
Affected Commands
kb link❌kb links bulk-create❌kb kb validate❌kb orient❌kb search✅kb get✅kb tags✅kb list-entries✅kb kb reindex✅kb kb list✅ (shows KB in registry)Investigation Notes
The main Pyrite DB at
~/.pyrite/pyrite.dbappears empty (.tablesand.schemareturn nothing), while the search index is populated. The link system may be looking for entries in the main DB rather than the search index, and the main DB may not have been provisioned for this KB type.