affaan-m/ECC · error · ValueError
invalid DID: {did!r} (must start with 'did:')
Error message
invalid DID: {did!r} (must start with 'did:') What it means
Error "invalid DID: {did!r} (must start with 'did:')" thrown in affaan-m/ECC.
Source
Thrown at integrations/aura/adapter.py:159
def aura_verdict(
did: str,
*,
base_url: str = DEFAULT_BASE_URL,
timeout: float = DEFAULT_TIMEOUT,
_fetch: Callable[[str, float], dict[str, Any]] = _http_get_json,
) -> AuraVerdict:
"""
Look up the trust verdict for a counterparty DID. Never raises on a
network/parse failure — returns an `unknown` verdict instead, leaving the
proceed/abort decision to the caller's policy (see before_settle).
v = aura_verdict("did:aura:z6Mk...")
print(v.verdict, v.reason, v.score)
`_fetch` is an injection seam for tests; production callers ignore it.
"""
if not did or not str(did).startswith("did:"):
raise ValueError(f"invalid DID: {did!r} (must start with 'did:')")
url = f"{base_url.rstrip('/')}/check?" + urllib.parse.urlencode({"did": did})
try:
body = _fetch(url, timeout)
except urllib.error.HTTPError as e:
return AuraVerdict.invalid_response(did, f"AURA returned HTTP {e.code}: {e.reason}")
except (urllib.error.URLError, TimeoutError, OSError) as e:
return AuraVerdict.unreachable(did, f"AURA unreachable: {e}")
except (json.JSONDecodeError, ValueError) as e:
return AuraVerdict.invalid_response(did, f"AURA returned non-JSON: {e}")
if not isinstance(body, dict):
return AuraVerdict.invalid_response(did, "AURA returned an unexpected shape")
return AuraVerdict.from_payload(did, body)
def before_settle(
did: str,View on GitHub (pinned to 01e15490f0)
Solutions
- Pass a DID string that starts with 'did:' (e.g. 'did:aura:z6Mk...'); empty or non-DID identifiers are rejected before any network call.
- Trim whitespace and verify the identifier came from the expected DID field, not a raw address or name.
Example fix
v = aura_verdict(f"did:aura:{raw_id}") if not raw_id.startswith('did:') else aura_verdict(raw_id) When it happens
Trigger: Thrown at integrations/aura/adapter.py:159 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/829a5b49f87625c5.
Report an issue: GitHub.