ruvnet/RuView · error · ValueError
Failed to load domain configuration: {e}
Error message
Failed to load domain configuration: {e} What it means
Wrapper exception in load-domain-config in archive/v1/src/config/domains.py. The loader reads a file, parses it, and constructs the config models; any exception anywhere in that chain — missing file (FileNotFoundError), invalid JSON/YAML syntax, nested pydantic ValidationError from the domain validators, key errors on malformed sections — is re-raised as ValueError('Failed to load domain configuration: {e}') with the original error chained in the message.
Source
Thrown at archive/v1/src/config/domains.py:468
for router_data in data.get("routers", []):
router = RouterConfig(**router_data)
config.add_router(router)
# Load pose models
for model_data in data.get("pose_models", []):
model = PoseModelConfig(**model_data)
config.add_pose_model(model)
# Load streaming config
if "streaming" in data:
config.streaming = StreamingConfig(**data["streaming"])
# Load alerts config
if "alerts" in data:
config.alerts = AlertConfig(**data["alerts"])
except Exception as e:
raise ValueError(f"Failed to load domain configuration: {e}")
return config
def save_domain_config_to_file(config: DomainConfig, file_path: str):
"""Save domain configuration to file."""
import json
try:
with open(file_path, 'w') as f:
json.dump(config.to_dict(), f, indent=2)
except Exception as e:
raise ValueError(f"Failed to save domain configuration: {e}")View on GitHub (pinned to 4685618388)
Solutions
- Read the tail of the message after 'Failed to load domain configuration:' — it names the actual failure (file error vs parse error vs validation error)
- If it is a nested pydantic ValidationError, fix the specific field it lists (e.g., threshold ranges)
- Validate the file parses standalone (python -c "import json; json.load(open(path))") before blaming the loader
- Confirm the path exists and is readable at the exact location the loader is given
Example fix
# before
config = load_domain_config_from_file("config/domains.json")
# after (fail with the real cause, not the wrapper)
try:
config = load_domain_config_from_file("config/domains.json")
except ValueError as e:
raise SystemExit(f"config load failed: {e}") from e.__cause__ or e Defensive patterns
Strategy: try-catch
Validate before calling
import json, os
path = "config/domains.json"
assert os.path.isfile(path) and os.access(path, os.R_OK), f"config not readable: {path}"
json.load(open(path)) # parse errors surface here with clean messages Type guard
def config_file_loadable(path: str) -> bool:
try:
with open(path) as f:
json.load(f)
return True
except (OSError, ValueError):
return False Try / catch
try:
config = load_domain_config_from_file(path)
except ValueError as e:
# the real cause is chained after 'Failed to load domain configuration:'
raise SystemExit(f"cannot load domain config: {e}") from None Prevention
- Validate the file exists and parses as JSON before invoking the loader
- Keep example/template configs out of the production load path
- Run the loader in CI against all shipped configs so schema drift fails the build, not the deploy
When it happens
Trigger: load_domain_config_from_file on a nonexistent path; a config file with a JSON syntax error; the 'pose_models'/'streaming'/'alerts' sections containing values that fail the field validators (e.g., thresholds out of range); required keys missing so construction raises KeyError/TypeError.
Common situations: Deploying with a config path that differs from the documented location; hand-edited config files with trailing commas or comments in strict JSON; upgrading the schema so old config files no longer validate; CI loading a template file with placeholder values.
Related errors
- Threshold must be between 0.0 and 1.0
- FPS must be between 1 and 60
- Compression level must be between 1 and 9
- Failed to save domain configuration: {e}
- Environment must be one of: {allowed_environments}
AI-assisted analysis of ruvnet/RuView@4685618388 (2026-08-16).
Data as JSON: /api/errors/93b6a46397d06d4c.
Report an issue: GitHub.