Corpus errors

Common error signatures

Corpus errors typically fall into three categories: duplicate alias declarations, missing or unreadable markdown files on disk, and failed lookups against a corpus that didn't load correctly.

Where errors originate

Each corpus implementation has distinct failure modes. Match the exception to the class before walking the call stack further.

How to diagnose

  1. Read DuplicateAliasError attributes directly. If you see this exception, inspect error.alias, error.first_path, and error.second_path. Open both files and remove or rename the duplicate alias declaration in one of them.

  2. Verify the corpus loaded entries. After constructing a DirectoryCorpus, call len(list(corpus.entries())) and inspect corpus.path_index. An empty index means the root path is wrong or the glob matched nothing — confirm root exists and contains *.md files.

  3. Check get() return values before attribute access. CorpusProtocol.get(path) returns None for an unknown path. If you're seeing AttributeError: 'NoneType' object has no attribute '...', add a None check or log the path value to confirm it matches the keys in path_index.

  4. Inspect the version fingerprint for caching issues. DirectoryCorpus.version is a SHA-256 fingerprint of the loaded corpus. If you suspect stale data when cache=True, compare the version value before and after the file change to confirm the corpus was actually reloaded.

  5. Isolate AttuneHelpCorpus adapter failures. If from_attune_help() raises, the bundled HelpCorpusAdapter may be missing from your installation. Verify the package was installed with its data files intact and that AttuneHelpCorpus.name and AttuneHelpCorpus.version return non-empty strings before making entries() or get() calls.

Source files

Tags: corpus, loader, markdown, attune-help