{"record":{"id":"c47aaaddd25705ef","repo":"certbot/certbot","slug":"the-supplied-code-s-is-not-a-known-acme-error-co","errorCode":null,"errorMessage":"The supplied code: %s is not a known ACME error code","messagePattern":"The supplied code: (.+?) is not a known ACME error code","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"acme/src/acme/messages.py","lineNumber":156,"sourceCode":"        'identifier', decoder=Identifier.from_json, omitempty=True)\n    subproblems: Optional[tuple['Error', ...]] = jose.field('subproblems', omitempty=True)\n\n    # Mypy does not understand the josepy magic happening here, and falsely claims\n    # that subproblems is redefined. Let's ignore the type check here.\n    @subproblems.decoder  # type: ignore\n    def subproblems(value: list[dict[str, Any]]) -> tuple['Error', ...]:  # pylint: disable=no-self-argument,missing-function-docstring\n        return tuple(Error.from_json(subproblem) for subproblem in value)\n\n    @classmethod\n    def with_code(cls, code: str, **kwargs: Any) -> 'Error':\n        \"\"\"Create an Error instance with an ACME Error code.\n\n        :str code: An ACME error code, like 'dnssec'.\n        :kwargs: kwargs to pass to Error.\n\n        \"\"\"\n        if code not in ERROR_CODES:\n            raise ValueError(\"The supplied code: %s is not a known ACME error\"\n                             \" code\" % code)\n        typ = ERROR_PREFIX + code\n        # Mypy will not understand that the Error constructor accepts a named argument\n        # \"typ\" because of josepy magic. Let's ignore the type check here.\n        return cls(typ=typ, **kwargs)\n\n    @property\n    def description(self) -> Optional[str]:\n        \"\"\"Hardcoded error description based on its type.\n\n        :returns: Description if standard ACME error or ``None``.\n        :rtype: str\n\n        \"\"\"\n        return ERROR_TYPE_DESCRIPTIONS.get(self.typ)\n\n    @property\n    def code(self) -> Optional[str]:","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/certbot/certbot/blob/2b817be14620d65f5215460e0022b1a7eb6eefd1/acme/src/acme/messages.py#L138-L174","documentation":"Raised by acme.messages.Error.with_code when the given code string is not a key of the ERROR_CODES mapping of known ACME error codes. The method exists to construct typed ACME errors (e.g. 'dnssec', 'connection') by prefixing the code with the ACME urn prefix, so it refuses unknown codes.","triggerScenarios":"Calling Error.with_code('someUnknownCode', ...) where the code is not registered in acme.messages.ERROR_CODES — e.g. typo like 'dnsSEC', a new RFC 8555 error type the installed acme version predates, or a vendor-specific code.","commonSituations":"Writing tests that simulate ACME server errors with an invented or misspelled code; handling a CA-specific error type not in the library's catalogue; upgrading servers that emit new error types while the client library is older.","solutions":["Check the code against acme.messages.ERROR_CODES and use a registered code such as 'dnssec', 'malformed', 'serverInternal'","If the code comes from a real server response, parse the error from the response JSON directly (Error.from_json/typ field) instead of with_code","Upgrade the acme package so newer error codes are included in ERROR_CODES"],"exampleFix":"# before\nError.with_code('dnsSEC')  # ValueError\n\n# after\nfrom acme import messages\nassert 'dnssec' in messages.ERROR_CODES\nmessages.Error.with_code('dnssec')","handlingStrategy":"validation","validationCode":"from acme import messages\nif code not in messages.ERROR_CODES:\n    raise KeyError(f'unknown ACME error code {code}; available: {sorted(messages.ERROR_CODES)}')","typeGuard":"from acme import messages\ndef is_known_acme_code(code: str) -> bool:\n    return code in messages.ERROR_CODES","tryCatchPattern":"try:\n    err = messages.Error.with_code(code)\nexcept ValueError:\n    err = messages.Error(typ='urn:ietf:params:acme:error:' + code, detail='...')","preventionTips":["Check ERROR_CODES membership in test helpers","Upgrade acme when CAs introduce new error types"],"tags":["acme","error-codes","validation"],"backgroundTag":"unknown-error-code","analyzedSha":"2b817be14620d65f5215460e0022b1a7eb6eefd1","analyzedAt":"2026-08-27T19:49:58.963Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}