hasura/graphql-engine · error
error in marshalling actions, custom_types from metadata: %w
Error message
error in marshalling actions, custom_types from metadata: %w
What it means
Export fails when the actions metadata struct cannot be re-serialized to YAML. After Build produces the actions object, Export encodes it with the YAML encoder; a marshal failure means the in-memory struct contains data the encoder cannot represent.
Source
Thrown at cli/internal/metadataobject/actions/actions.go:578
if err != nil {
return nil, errors.E(op, a.error(err))
}
actions := map[string]yaml.Node{}
if v, ok := metadata[metadataobject.ActionsKey]; ok {
actions[metadataobject.ActionsKey] = v
}
if v, ok := metadata[metadataobject.CustomTypesKey]; ok {
actions[metadataobject.CustomTypesKey] = v
}
ymlByt := new(bytes.Buffer)
if err := metadataobject.GetEncoder(ymlByt).Encode(actions); err != nil {
return nil, errors.E(
op,
a.error(
fmt.Errorf("error in marshalling actions, custom_types from metadata: %w", err),
),
)
}
var common types.Common
err = yaml.NewDecoder(ymlByt).Decode(&common)
if err != nil {
return nil, errors.E(op, a.error(fmt.Errorf("error in unmarshal to common: %w", err)))
}
var sdlToReq types.SDLToRequest
sdlToReq.Types = common.CustomTypes
sdlToReq.Actions = common.Actions
sdlToResp, err := a.cliExtensionConfig.ConvertMetadataToSDL(sdlToReq)
if err != nil {View on GitHub (pinned to 724551b9ae)
Solutions
- Inspect the actions metadata input for unusual values (non-string map keys, invalid types) and normalize them
- Re-load and rebuild metadata from a known-good export
- Report upstream if the struct itself fails to marshal with valid metadata
Defensive patterns
Strategy: try-catch
Try / catch
files, err := actionsObj.Export(ctx)
if err != nil {
if strings.Contains(err.Error(), "error in marshalling actions") {
// inspect/normalize the source metadata, then retry with cleaned metadata
}
return err
} Prevention
- Keep metadata within documented field types
- Export from server-produced metadata as a known-good baseline
When it happens
Trigger: Calling Export() when the actions struct contains fields that cannot be YAML-encoded, such as unsupported map key types, NaN/Inf floats, or corrupted internal state after a partial build.
Common situations: Metadata loaded from an exotic or hand-edited YAML file that unmarshals into a degenerate struct; upstream schema changes introducing non-serializable fields.
Related errors
- error in marshaling common: %w
- unable to marshal run_sql args in %s: %w
- error in marshalling common: %w
- error in unmarshal to common: %w
- unable to unmarshal run_sql args in %s: %w
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/8fdedcfd280757a8.
Report an issue: GitHub.