{"record":{"id":"87e9d19cb116044d","repo":"hasura/graphql-engine","slug":"error-in-marshalling-common-w","errorCode":null,"errorMessage":"error in marshalling common: %w","messagePattern":"error in marshalling common: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/internal/metadataobject/actions/actions.go","lineNumber":236,"sourceCode":"\t\tfor oldTypeObjIndex, oldTypeObj := range oldAction.CustomTypes.Scalars {\n\t\t\tif customType.Name == oldTypeObj.Name {\n\t\t\t\tsdlFromResp.Types.Scalars[customTypeIndex].Description = oldAction.CustomTypes.Scalars[oldTypeObjIndex].Description\n\t\t\t\tsdlFromResp.Types.Scalars[customTypeIndex].Relationships = oldAction.CustomTypes.Scalars[oldTypeObjIndex].Relationships\n\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tvar common types.Common\n\n\tcommon.Actions = sdlFromResp.Actions\n\tcommon.CustomTypes = sdlFromResp.Types\n\tcommon.SetExportDefault()\n\t// write actions.yaml\n\tcommonByt, err := yaml.Marshal(common)\n\tif err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"error in marshalling common: %w\", err))\n\t}\n\n\terr = os.WriteFile(filepath.Join(a.MetadataDir, a.Filename()), commonByt, 0o644)\n\tif err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"error in writing %s file: %w\", a.Filename(), err))\n\t}\n\n\terr = os.WriteFile(filepath.Join(a.MetadataDir, graphqlFileName), data, 0o644)\n\tif err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"error in writing %s file: %w\", graphqlFileName, err))\n\t}\n\n\treturn nil\n}\n\nfunc (a *ActionConfig) Codegen(name string, derivePld types.DerivePayload) error {\n\tvar op errors.Op = \"actions.ActionConfig.Codegen\"\n","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/internal/metadataobject/actions/actions.go#L218-L254","documentation":"Create fails when yaml.Marshal of the consolidated actions config (common, which now holds the SDL-derived actions and custom types) returns an error. This is a serialization failure of the in-memory ActionConfig into actions.yaml, usually caused by fields that cannot round-trip through YAML.","triggerScenarios":"Calling actions Create after the SDL conversion step, when the parsed action objects contain types, custom types, or handler definitions with fields yaml.Marshal cannot encode (e.g. maps with non-string keys, channels, unsupported marshaler output).","commonSituations":"A version mismatch between the CLI and the codegen extension producing action metadata with unexpected field shapes; hand-edited actions.yaml introducing incompatible structures; custom types with invalid YAML tags.","solutions":["Check the wrapped error for the exact field yaml.Marshal choked on","Upgrade the hasura CLI and the actions codegen extension to matching versions and retry","Regenerate actions.yaml from scratch (delete and re-create) instead of merging with a hand-edited file","If a custom type is involved, simplify it and re-add fields incrementally to find the offender"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// err is *errors.E from hasura CLI; inspect .Op()/kind and the wrapped yaml error\nif err := actionCfg.Create(ctx); err != nil {\n    var yamlErr *yaml.TypeError\n    if errors.As(err, &yamlErr) {\n        for _, line := range yamlErr.Errors { log.Printf(\"yaml field issue: %s\", line) }\n    }\n    return err\n}","preventionTips":["Keep the CLI and codegen extension versions in sync so emitted action structs match the marshaler","Don't hand-edit generated sections of actions.yaml","Pin the hasura CLI version in CI to avoid surprise schema changes"],"tags":["yaml","serialization","actions","cli"],"backgroundTag":"yaml-serialization-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}