{"record":{"id":"b45f49c7e563350c","repo":"hasura/graphql-engine","slug":"cannot-write-config-file-w","errorCode":null,"errorMessage":"cannot write config file: %w","messagePattern":"cannot write config file: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/commands/init.go","lineNumber":287,"sourceCode":"\tif o.Endpoint != \"\" {\n\t\tif _, err := url.ParseRequestURI(o.Endpoint); err != nil {\n\t\t\treturn errors.E(op, fmt.Errorf(\"error validating endpoint URL: %w\", err))\n\t\t}\n\n\t\tconfig.Endpoint = o.Endpoint\n\t}\n\n\tif o.AdminSecret != \"\" {\n\t\tconfig.AdminSecret = o.AdminSecret\n\t}\n\n\t// write the config file\n\to.EC.Config = config\n\to.EC.ConfigFile = filepath.Join(o.EC.ExecutionDirectory, \"config.yaml\")\n\n\terr = o.EC.WriteConfig(nil)\n\tif err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"cannot write config file: %w\", err))\n\t}\n\n\t// create migrations directory\n\to.EC.MigrationDir = filepath.Join(o.EC.ExecutionDirectory, cli.DefaultMigrationsDirectory)\n\n\terr = os.MkdirAll(o.EC.MigrationDir, os.ModePerm)\n\tif err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"cannot write migration directory: %w\", err))\n\t}\n\n\tif config.Version >= cli.V2 {\n\t\t// create metadata directory\n\t\to.EC.MetadataDir = filepath.Join(o.EC.ExecutionDirectory, cli.DefaultMetadataDirectory)\n\n\t\terr = os.MkdirAll(o.EC.MetadataDir, os.ModePerm)\n\t\tif err != nil {\n\t\t\treturn errors.E(op, fmt.Errorf(\"cannot write metadata directory: %w\", err))\n\t\t}","sourceCodeStart":269,"sourceCodeEnd":305,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/init.go#L269-L305","documentation":"`hasura init` failed to write the generated config.yaml via o.EC.WriteConfig after scaffolding the config object. Wrapped error typically indicates an OS-level write failure or serialization problem in the execution directory.","triggerScenarios":"Execution directory became unwritable, disk full, or the config could not be marshalled/written to <dir>/config.yaml during init.","commonSituations":"Read-only project mount in a container; disk quota; antivirus/locking on config.yaml; concurrent init runs writing the same path.","solutions":["Check write access and free space in the init directory","Remove partially-created project and re-run init cleanly","Ensure no other process holds/locks config.yaml"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// ensure config.yaml path is writable\nf := filepath.Join(executionDir, \"config.yaml\")\nif _, err := os.OpenFile(f, os.O_WRONLY|os.O_CREATE, 0o644); err != nil {\n    log.Fatal(\"config.yaml not writable: \", err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check disk space and locks on config.yaml","Run init on writable mounts only"],"tags":["hasura","cli","init","config-file","write"],"backgroundTag":"config-write-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}