policy_invalid
A policy you pushed (POST /v1/policies, POST /v1/policies/{id}/versions), dry-ran (POST /v1/policies/evaluate with a source) or tested (POST /v1/policies/test) didn’t compile.
HTTP 400 · invalid_request_error · not retryable
What happened
Section titled “What happened”A policy you pushed (POST /v1/policies, POST /v1/policies/{id}/versions), dry-ran (POST /v1/policies/evaluate with a source) or tested (POST /v1/policies/test) didn’t compile. Nothing was saved.
What to do
Section titled “What to do”Read diagnostics: each entry has the line and column, a stable code (documented in the policy errors reference), a message and a hint. Fix the file, check it locally with deedglass policy lint, and push again. diagnostics is an additive envelope field: it appears on this code only.
Example
Section titled “Example”{ "error": { "type": "invalid_request_error", "code": "policy_invalid", "message": "The policy has 1 error, on line 5: Unknown key \"desicion\" in rule \"a\".", "param": "source", "diagnostics": [ { "object": "policy_diagnostic", "severity": "error", "code": "unknown_key", "line": 5, "column": 5, "message": "Unknown key \"desicion\" in rule \"a\".", "hint": "Did you mean \"decision\"?", "doc_url": "https://docs.deedglass.com/policies/errors/unknown_key" } ], "request_id": "req_01j9zr3m5k8q2w7x4t6v0b1c9d", "doc_url": "https://docs.deedglass.com/errors/policy_invalid" }}The message is for a person and can get more exact over time: branch on type and code, never on the message.
In the SDKs
Section titled “In the SDKs”| SDK | Raised as |
|---|---|
TypeScript (@deedglass/sdk) |
InvalidRequestError with code === "policy_invalid" |
Python (deedglass) |
deedglass.InvalidRequestError with .code == "policy_invalid" |