ory/hydra · error

failed to evaluate jsonnet

Error message

failed to evaluate jsonnet

What it means

Returned by the jsonnet CLI's RunE when evaluating the stdin snippet with the Jsonnet VM fails. This is a user-content error: the snippet has a syntax error, unknown variable, or exceeds limits; the wrapped error carries the Jsonnet diagnostics with line/column info.

Source

Thrown at oryx/jsonnetsecure/cmd.go:60

				return errors.Wrap(err, "failed to apply empty landlock sandbox")
			}

			// This could fail because current limits are lower than what we tried to set,
			// so we still continue in this case.
			SetVirtualMemoryLimit(virtualMemoryLimitBytes)

			if null {
				return scan(cmd.OutOrStdout(), cmd.InOrStdin())
			}

			input, err := io.ReadAll(cmd.InOrStdin())
			if err != nil {
				return errors.Wrap(err, "failed to read from stdin")
			}

			json, err := eval(input)
			if err != nil {
				return errors.Wrap(err, "failed to evaluate jsonnet")
			}

			if _, err := io.WriteString(cmd.OutOrStdout(), json); err != nil {
				return errors.Wrap(err, "failed to write json output")
			}
			return nil
		},
	}
	cmd.Flags().BoolVarP(&null, "null", "0", false,
		`Read multiple snippets and parameters from stdin separated by null bytes.
Output will be in the same order as inputs, separated by null bytes.
Evaluation errors will also be reported to stdout, separated by null bytes.
Non-recoverable errors are written to stderr and the program will terminate with a non-zero exit code.`)

	return cmd
}

func scan(w io.Writer, r io.Reader) error {

View on GitHub (pinned to 4174065ffb)

Solutions

  1. Read the wrapped Jsonnet error for the exact snippet location and fix the snippet
  2. Validate/compile user-supplied jsonnet before sending it to the worker
  3. If caused by resource limits, reduce snippet complexity or raise the memory limit
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at oryx/jsonnetsecure/cmd.go:60 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ory/hydra@4174065ffb (2026-09-03). Data as JSON: /api/errors/529050e5719bee10. Report an issue: GitHub.