Skip to content

Error codes

The stable issue registry and helpers for local validation, result inspection, and tool failures. See the error-code table.

Registry

ErrorCode dataclass

ErrorCode(
    id: str,
    severity: str,
    category: str,
    title: str,
    fix: str,
)

id instance-attribute

id: str

severity instance-attribute

severity: str

category instance-attribute

category: str

title instance-attribute

title: str

fix instance-attribute

fix: str

CODES module-attribute

CODES: dict[str, ErrorCode] = {
    id_: ErrorCode(
        id_,
        "info"
        if id_ in _INFO_IDS
        else "warning"
        if id_ in _WARNING_IDS
        else "error",
        category,
        _TITLES[id_],
        fix,
    )
    for category, entries in _GROUPS.items()
    for id_, fix in entries.items()
}

error_catalog

error_catalog() -> list[dict]

Return the JSON-serializable registry ordered by stable ID.

Issues and failures

issue

issue(
    id: str,
    message: str,
    *,
    path=None,
    monitor=None,
    severity=None,
    fix=None,
    **detail,
) -> dict

Create a registered issue, preserving caller detail and overrides.

issue_from_finding

issue_from_finding(finding: dict, *, path=None) -> dict

Map a setup, result, or repair-carrying finding to an issue.

CodedError

CodedError(id: str, message: str, fix: str | None = None)

Bases: ValueError

Tool failure carrying a stable issue ID and a JSON string form.

id instance-attribute

id = id

message instance-attribute

message = message

fix instance-attribute

fix = fix or code.fix