hasura/graphql-engine · error
error in marshaling common: %w
Error message
error in marshaling common: %w
What it means
Export fails when the final types.Common struct (with export defaults applied) cannot be re-encoded to YAML. This is the last serialization step writing the actions metadata file.
Source
Thrown at cli/internal/metadataobject/actions/actions.go:607
var sdlToReq types.SDLToRequest
sdlToReq.Types = common.CustomTypes
sdlToReq.Actions = common.Actions
sdlToResp, err := a.cliExtensionConfig.ConvertMetadataToSDL(sdlToReq)
if err != nil {
return nil, errors.E(
op,
a.error(fmt.Errorf("error in converting metadata to sdl: %w", err)),
)
}
common.SetExportDefault()
commonByt := new(bytes.Buffer)
if err = metadataobject.GetEncoder(commonByt).Encode(common); err != nil {
return nil, errors.E(op, a.error(fmt.Errorf("error in marshaling common: %w", err)))
}
return map[string][]byte{
filepath.ToSlash(filepath.Join(a.MetadataDir, a.Filename())): commonByt.Bytes(),
filepath.ToSlash(filepath.Join(a.MetadataDir, graphqlFileName)): []byte(
sdlToResp.SDL.Complete,
),
}, nil
}
func (a *ActionConfig) Key() string {
return metadataobject.ActionsKey
}
func (a *ActionConfig) Filename() string {
return "actions.yaml"
}
View on GitHub (pinned to 724551b9ae)
Solutions
- Pin/align the cli-ext plugin version with your CLI version
- Reproduce with minimal metadata to find the offending field and fix it upstream in metadata
- File an issue with the metadata that triggers the marshal failure
Defensive patterns
Strategy: try-catch
Try / catch
if err := obj.Export(ctx); err != nil {
if strings.Contains(err.Error(), "error in marshaling common") {
// pin/upgrade cli-ext and retry from clean metadata
}
} Prevention
- Use clean server-exported metadata as input
- Match plugin and CLI versions
When it happens
Trigger: Calling Export() when SetExportDefault() or prior conversion produced a Common struct the YAML encoder rejects, e.g. unsupported value types introduced by conversion output.
Common situations: Conversion output with unexpected field types after a CLI extension version change; corrupt metadata state.
Related errors
- error in marshalling actions, custom_types from metadata: %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/065489b2f6a0f313.
Report an issue: GitHub.