{"record":{"id":"c22f624bccec154e","repo":"hasura/graphql-engine","slug":"error-in-unmarshal-to-common-w","errorCode":null,"errorMessage":"error in unmarshal to common: %w","messagePattern":"error in unmarshal to common: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/internal/metadataobject/actions/actions.go","lineNumber":587,"sourceCode":"\tif v, ok := metadata[metadataobject.CustomTypesKey]; ok {\n\t\tactions[metadataobject.CustomTypesKey] = v\n\t}\n\n\tymlByt := new(bytes.Buffer)\n\tif err := metadataobject.GetEncoder(ymlByt).Encode(actions); err != nil {\n\t\treturn nil, errors.E(\n\t\t\top,\n\t\t\ta.error(\n\t\t\t\tfmt.Errorf(\"error in marshalling actions, custom_types from metadata: %w\", err),\n\t\t\t),\n\t\t)\n\t}\n\n\tvar common types.Common\n\n\terr = yaml.NewDecoder(ymlByt).Decode(&common)\n\tif err != nil {\n\t\treturn nil, errors.E(op, a.error(fmt.Errorf(\"error in unmarshal to common: %w\", err)))\n\t}\n\n\tvar sdlToReq types.SDLToRequest\n\n\tsdlToReq.Types = common.CustomTypes\n\tsdlToReq.Actions = common.Actions\n\n\tsdlToResp, err := a.cliExtensionConfig.ConvertMetadataToSDL(sdlToReq)\n\tif err != nil {\n\t\treturn nil, errors.E(\n\t\t\top,\n\t\t\ta.error(fmt.Errorf(\"error in converting metadata to sdl: %w\", err)),\n\t\t)\n\t}\n\n\tcommon.SetExportDefault()\n\n\tcommonByt := new(bytes.Buffer)","sourceCodeStart":569,"sourceCodeEnd":605,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/internal/metadataobject/actions/actions.go#L569-L605","documentation":"Export re-decodes the freshly marshaled actions YAML into a types.Common struct; failure here means the serialized actions/custom_types payload does not conform to the Common schema expected by the export pipeline.","triggerScenarios":"Calling Export() when the intermediate YAML (actions + custom_types) contains fields or shapes that types.Common cannot unmarshal, e.g. unexpected nested structures or duplicate keys resolved into incompatible types.","commonSituations":"Version mismatch between the CLI and the metadata spec; hand-crafted metadata with extra/renamed fields; corrupt metadata files.","solutions":["Validate the actions metadata against the version of the CLI being used (check for CLI/metadata version drift)","Simplify the metadata to known fields and re-export","Upgrade or align the CLI version with the metadata format"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Validate metadata parses as the expected schema before export\nvar c types.Common\nif err := yaml.Unmarshal(raw, &c); err != nil { /* fix metadata first */ }","typeGuard":null,"tryCatchPattern":"if err := obj.Export(ctx); err != nil {\n  if strings.Contains(err.Error(), \"error in unmarshal to common\") {\n    // metadata format drift: align CLI version or fix fields\n  }\n}","preventionTips":["Pin CLI version matching your metadata spec","Validate metadata with the CLI's metadata validation before export"],"tags":["hasura","actions","yaml","unmarshal"],"backgroundTag":"yaml-unmarshaling-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}