{"record":{"id":"8e06f9dae775ab2d","repo":"hasura/graphql-engine","slug":"error-in-writing-config-w","errorCode":null,"errorMessage":"error in writing config: %w","messagePattern":"error in writing config: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/commands/actions_use_codegen.go","lineNumber":245,"sourceCode":"\t\toutputDir, err := util.GetFSPathPrompt(\n\t\t\t\"Where do you want to place the codegen files?\",\n\t\t\to.EC.Config.ActionConfig.Codegen.OutputDir,\n\t\t)\n\t\tif err != nil {\n\t\t\treturn errors.E(op, fmt.Errorf(\"error in getting output directory input: %w\", err))\n\t\t}\n\n\t\tnewCodegenExecutionConfig.OutputDir = outputDir\n\t} else {\n\t\tnewCodegenExecutionConfig.OutputDir = o.outputDir\n\t}\n\n\tnewConfig := o.EC.Config\n\tnewConfig.ActionConfig.Codegen = newCodegenExecutionConfig\n\n\terr = o.EC.WriteConfig(newConfig)\n\tif err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"error in writing config: %w\", err))\n\t}\n\n\to.EC.Spinner.Stop()\n\to.EC.Logger.Info(\"Codegen configuration updated in config.yaml\")\n\n\treturn nil\n}\n","sourceCodeStart":227,"sourceCodeEnd":253,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/actions_use_codegen.go#L227-L253","documentation":"Thrown when o.EC.WriteConfig(newConfig) fails while persisting the newly chosen codegen settings to config.yaml at the end of `hasura actions use-codegen`. This is a local file write/serialize error: unwritable file, invalid config state, or file locked by another process.","triggerScenarios":"Finishing use-codegen when config.yaml is read-only, owned by another user, missing with an unwritable parent directory, or when the config object cannot be serialized (unexpected values).","commonSituations":"Running the CLI in a container/CI checkout as a non-root user without write access to the project dir; config.yaml permissions changed; editors or watchers locking the file on some platforms.","solutions":["Check permissions on config.yaml and its directory; chmod/chown as needed.","Ensure the CLI process runs as a user with write access to the project.","If config.yaml is corrupted, restore or regenerate it (hasura init) and re-run the selection."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"test -w config.yaml || chmod u+w config.yaml; yq e '.' config.yaml >/dev/null","typeGuard":null,"tryCatchPattern":"Catch, fix config.yaml permissions/ownership, and re-run `hasura actions use-codegen` with the same flags.","preventionTips":["Run the CLI as a user with write access to the project.","Keep config.yaml valid and version-controlled.","Avoid concurrent CLI runs writing config."],"tags":["config","filesystem","hasura-cli"],"backgroundTag":"config-write-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}