Troubleshooting¶
IDE Not Showing Autocomplete¶
Symptoms: - No autocomplete for config attributes - IDE doesn't recognize config structure
Solutions:
- Ensure the
.pyifile exists next to yourload_config.py - Reload your IDE/editor window
- Check that your language server is running (VSCode: check Python extension)
- For PyCharm:
File→Invalidate Caches→Restart
Config Object is Immutable¶
Error:
Cause: Config is frozen by default (immutable dataclass).
Solutions:
Option 1: Use mutate_config() helper (recommended)
from heracless.utils.helper import mutate_config
config = load_config()
new_config = mutate_config(config, "database.host", "new-host")
Option 2: Load with frozen=False (not recommended for production)
YAML Parsing Errors¶
Error:
Cause: Invalid YAML syntax in config file.
Solution: Validate your YAML:
Common issues: - Incorrect indentation - Missing colons - Invalid characters - Mixing tabs and spaces
FileNotFoundError¶
Error:
Solutions:
- Check the path in
CONFIG_YAML_PATHis correct - Use absolute paths or
Path(__file__)for relative paths: - Verify the config file exists:
Type Checking Not Working¶
Symptoms: - mypy doesn't catch config typos - No type errors for invalid attribute access
Solutions:
- Ensure
.pyistub file is generated (setstub_dump=True) - Run mypy with correct configuration:
- Check mypy is using the correct Python version:
Stub File Not Generated¶
Cause: stub_dump=False or file_path=None
Solution:
def load_config(..., stub_dump: bool = True) -> Config:
file_path = Path(__file__).resolve() if stub_dump else None
return _load_config(config_path, file_path, frozen=frozen)
Ensure stub_dump=True (default).
Still Having Issues?¶
If you encounter other problems:
- Check the GitHub Issues
- Open a new issue with:
- Heracless version (
pip show heracless) - Python version
- Operating system
- Minimal reproducible example
- Expected vs actual behavior