Help System errors
Common error signatures
Errors in the help system fall into three main categories:
ValueError: Invalid feature name: {...}— raised bygenerate_feature_templates()when theFeaturepassed has a name that fails validation. Check thefeature.namefield before calling the generator.FileNotFoundError/OSError— raised byload_manifest(),save_manifest(),check_staleness(), orrun_maintenance()whenhelp_dirorproject_rootdoes not exist or is not readable. Verify both paths before calling these functions.KeyError/Nonereturn frompopulate()orpopulate_progressive()—populate()returnsNonewhen thetemplate_iddoes not resolve to a file undergenerated_dir. A missing or incorrectgenerated_diris the most common cause.- Stale hash mismatch —
check_staleness()returns aStalenessReportwithstale_count > 0when source files have changed since the lastrun_maintenance()run. This is not an exception, but it causesget_workflow_help()andget_precursor_warnings()to serve outdated templates.
Where errors originate
The following functions are the most common raise sites. The cause and the likely fix are paired for each:
generate_feature_templates(feature, help_dir, project_root)— raisesValueErrorfor an invalidfeature.name. Ensure theFeaturedataclass was constructed with a non-empty, valid name string.load_manifest(help_dir)/save_manifest(manifest, help_dir)— raisesOSErrorifhelp_dirdoes not exist or the process lacks write permission. Create the directory and check permissions before calling either function.scan_project(project_root)— raisesOSErrorifproject_rootis not a readable directory. Returns an empty list (no exception) when no features are detected, which causesproposals_to_manifest()to produce an emptyFeatureManifest.populate(template_id, ...)— returnsNone(no exception) when the template file is missing. Passing a wronggenerated_diror a misspelledtemplate_idboth produce this silent failure.record_template_feedback(template_id, rating)— writes tofeedback.jsoningenerated_dir; raisesOSErrorif the directory is not writable.run_maintenance(help_dir, project_root)— records failed feature names inMaintenanceResult.failed. Checkresult.failedafter the call; a non-empty list means one or more features were not regenerated.
How to diagnose
-
Check
MaintenanceResult.failedafterrun_maintenance(). A non-emptyfailedlist means specific features could not be regenerated. Re-run withdry_run=Truefirst to see whatcheck_staleness()reports without making changes. -
Call
check_staleness()directly to isolate hash mismatches. CompareStalenessReport.stale_featuresagainst your expected feature names. If the list is unexpectedly large,get_changed_files(project_root)shows which source files triggered the staleness. -
Confirm
populate()receives the correctgenerated_dir. Whenpopulate()returnsNone, callsearch_by_tag()orlist_tags()with the samegenerated_dirto confirm templates exist there. A result of{}means the directory is wrong or empty. -
Validate
Featurefields before generation.generate_feature_templates()raisesValueError: Invalid feature name: {...}synchronously. Logfeature.name,feature.files, andfeature.tagsbefore the call to confirm theFeaturedataclass is populated correctly. -
Check
resolve_topic()whenget_workflow_help()returns an empty list.get_workflow_help()relies onresolve_topic(query, manifest)to map a workflow name to a feature. Ifresolve_topic()returnsNone, no templates are returned. Pass yourworkflow_nametoresolve_topic()directly and inspect the result.
Source files
src/attune/help/**packages/attune-help/src/attune_help/**
Tags: help, templates, docs