{"record":{"id":"e16c4e0c6390ac87","repo":"hasura/graphql-engine","slug":"unable-to-marshal-run-sql-args-in-s-w","errorCode":null,"errorMessage":"unable to marshal run_sql args in %s: %w","messagePattern":"unable to marshal run_sql args in (.+?): %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/commands/scripts_update_config_v2.go","lineNumber":159,"sourceCode":"\n\t\t\t\tvar queries []hasuradb.HasuraInterfaceQuery\n\n\t\t\t\terr = yaml.Unmarshal(buf.Bytes(), &queries)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn errors.E(\n\t\t\t\t\t\top,\n\t\t\t\t\t\tfmt.Errorf(\"unable to unmarshal %s: %w\", upMetaMigration.Raw, err),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\t// for each query check if type is run_sql\n\t\t\t\t// if yes, append to bytes buffer\n\t\t\t\tfor _, query := range queries {\n\t\t\t\t\tif query.Type == \"run_sql\" {\n\t\t\t\t\t\targByt, err := yaml.Marshal(query.Args)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn errors.E(\n\t\t\t\t\t\t\t\top,\n\t\t\t\t\t\t\t\tfmt.Errorf(\n\t\t\t\t\t\t\t\t\t\"unable to marshal run_sql args in %s: %w\",\n\t\t\t\t\t\t\t\t\tupMetaMigration.Raw,\n\t\t\t\t\t\t\t\t\terr,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tvar to hasura.PGRunSQLInput\n\n\t\t\t\t\t\terr = yaml.Unmarshal(argByt, &to)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn errors.E(\n\t\t\t\t\t\t\t\top,\n\t\t\t\t\t\t\t\tfmt.Errorf(\n\t\t\t\t\t\t\t\t\t\"unable to unmarshal run_sql args in %s: %w\",\n\t\t\t\t\t\t\t\t\tupMetaMigration.Raw,\n\t\t\t\t\t\t\t\t\terr,\n\t\t\t\t\t\t\t\t),","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/scripts_update_config_v2.go#L141-L177","documentation":"Thrown while running `hasura scripts update-project-v2` when converting a v1 up.yaml metadata migration. For each query of type run_sql the script marshals query.Args to YAML; if yaml.Marshal fails (essentially only for values that cannot be represented in YAML, such as NaN, -Inf, or unsupported map key types), this error wraps the marshal failure along with the offending migration filename.","triggerScenarios":"Executing update-project-v2 against a migrations directory whose <version>.up.yaml contains a run_sql entry whose args fail to serialize (e.g. a float NaN/Inf value or invalid map key inside args).","commonSituations":"Hand-edited YAML migrations with malformed arg values; migrations generated by older CLI versions or external tooling that injected non-serializable values into run_sql args.","solutions":["Inspect the file named in the error message and fix or remove invalid values in the run_sql args","Restore the migrations directory from migrations_backup and re-run the script after fixing","Regenerate the offending migration with the current CLI rather than hand-editing args"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before running update-project-v2, scan migration yaml files\nimport (\n  \"os\"\n  \"path/filepath\"\n  \"go.yaml.in/yaml/v3\"\n)\nfunc checkRunnable(dir string) error {\n  return filepath.Walk(dir, func(p string, info os.FileInfo, err error) error {\n    if err != nil || filepath.Ext(p) != \".yaml\" { return err }\n    b, rerr := os.ReadFile(p); if rerr != nil { return rerr }\n    var q []map[string]any\n    if uerr := yaml.Unmarshal(b, &q); uerr != nil { return uerr }\n    for _, item := range q {\n      if item[\"type\"] == \"run_sql\" {\n        if _, merr := yaml.Marshal(item[\"args\"]); merr != nil { return merr }\n      }\n    }\n    return nil\n  })\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate all migration YAML files parse cleanly before running update-project-v2","Never hand-edit run_sql args; regenerate migrations with the CLI","Keep migrations under version control so bad edits are detectable via diffs"],"tags":["hasura","cli","yaml","migration","serialization"],"backgroundTag":"yaml-marshal-failure","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}