hasura/graphql-engine · error
convert to yaml: %w
Error message
convert to yaml: %w
What it means
StoreManifest serializes a Plugin struct to YAML before writing the plugin receipt file; this error means yaml.Marshal failed. With a plain data struct this is rare, and usually indicates a field type the YAML encoder cannot handle (e.g. custom types with broken MarshalYAML, channels, funcs, or cyclic references).
Source
Thrown at cli/plugins/plugins.go:476
}
func (c *Config) LoadManifest(path string) (Plugin, error) {
var op errors.Op = "plugins.Config.LoadManifest"
plugin, err := c.ReadPluginFromFile(path)
if err != nil {
return plugin, errors.E(op, err)
}
return plugin, nil
}
func (c *Config) StoreManifest(plugin Plugin, dest string) error {
var op errors.Op = "plugins.Config.StoreManifest"
yamlBytes, err := yaml.Marshal(plugin)
if err != nil {
return errors.E(op, fmt.Errorf("convert to yaml: %w", err))
}
err = os.WriteFile(dest, yamlBytes, 0o644)
if err != nil {
return errors.E(op, fmt.Errorf("write plugin receipt %q: %w", dest, err))
}
return nil
}
View on GitHub (pinned to 724551b9ae)
Solutions
- Inspect the Plugin struct for custom MarshalYAML methods or non-serializable field types (func, chan, complex) and fix them
- Check for cyclic references between Plugin and nested structs
- Unit-test yaml.Marshal on the exact Plugin value being stored to reproduce the encoder error
Example fix
// before
type Plugin struct {
Hooks chan Hook // yaml cannot marshal channels
}
// after
type Plugin struct {
Hooks []Hook
} Defensive patterns
Strategy: validation
Validate before calling
if _, err := yaml.Marshal(plugin); err != nil { return fmt.Errorf("plugin not serializable: %w", err) } Try / catch
if err := cfg.StoreManifest(plugin, dest); err != nil {
if strings.Contains(err.Error(), "convert to yaml") {
// fix Plugin struct fields; do not retry
}
} Prevention
- Keep Plugin as a plain serializable struct; avoid func/chan/cyclic fields
- Unit-test yaml.Marshal round-trip for any new Plugin fields
When it happens
Trigger: Calling Config.Install or Config.Upgrade with a Plugin whose fields include a type implementing yaml.Marshaler that itself returns an error, or a cyclic data structure.
Common situations: Custom plugin structs with map[interface{}]interface{} keys that are not marshalable; a fork or version change that added non-serializable fields to Plugin; NaN/Inf values in unsupported key positions.
Related errors
- unable to marshal run_sql args in %s: %w
- error in marshalling common: %w
- error in marshalling actions, custom_types from metadata: %w
- error in marshaling common: %w
- error in executing pre-response plugins, unable to encode re
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/16a1d55f5c4a07f6.
Report an issue: GitHub.