# chainctl policies custom validate

URL: https://edu.chainguard.dev/platform/chainctl/chainctl-docs/chainctl_policies_custom_validate.md
Last Modified: July 30, 2026
Tags: chainctl, Reference, Product

 chainctl policies custom validate Validate a custom policy manifest or expression without persisting it.
Synopsis Validate a policy without creating it to catch problems.
Two modes are supported:
&ndash;file: validates a full policy manifest (YAML). Expression and parameters are both checked.
&ndash;expression: validates just a Rego expression (a raw .rego file). Useful during authoring for a fast parse + compile check.
Prints structured diagnostics on errors, indicating if the policy is invalid. Expression errors include the line and column in the Rego source; parameter-schema errors identify the offending field (e.g. parameter_schemas[0].name).
Policy expressions must be declared under package chainguard.policies and must define an allow rule; validation rejects a module that defines neither.
chainctl policies custom validate --file POLICY.yaml | --expression POLICY.rego [flags] Examples # Check an existing policy layout for reference chainctl policies describe --policy cooldown --parent example.com -o json # Validate a manifest before creating the policy chainctl policies custom validate --file policy.yaml # Validate just the Rego expression chainctl policies custom validate --expression policy.rego Options -e, --expression string Path to a Rego expression (.rego) file. Validates the expression only; skips parameters. -f, --file string Path to a policy manifest YAML file. Options inherited from parent commands --api string The url of the Chainguard platform API. (default &#34;https://console-api.enforce.dev&#34;) --audience string The Chainguard token audience to request. (default &#34;https://console-api.enforce.dev&#34;) --config string A specific chainctl config file. Uses CHAINCTL_CONFIG environment variable if a file is not passed explicitly. --console string The url of the Chainguard platform Console. (default &#34;https://console.chainguard.dev&#34;) --force-color Force color output even when stdout is not a TTY. -h, --help Help for chainctl --issuer string The url of the Chainguard STS endpoint. (default &#34;https://issuer.enforce.dev&#34;) --log-level string Set the log level (debug, info) (default &#34;ERROR&#34;) -o, --output string Output format. One of: [csv, env, go-template, id, json, markdown, none, table, terse, tree, wide] -v, --v int Set the log verbosity level. SEE ALSO chainctl policies custom	- Manage your custom policies. 
