{"record":{"id":"703b17be00777f7b","repo":"hasura/graphql-engine","slug":"failed-to-create-seed-file-w","errorCode":null,"errorMessage":"failed to create seed file: %w","messagePattern":"failed to create seed file: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/commands/seed_create.go","lineNumber":169,"sourceCode":"\n\t\t\tbody, err = editor.CaptureInputFromEditor(\n\t\t\t\teditor.GetPreferredEditorFromEnvironment,\n\t\t\t\tdefaultText,\n\t\t\t\t\"sql\",\n\t\t\t)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.E(op, fmt.Errorf(\"cannot find default editor from env: %w\", err))\n\t\t\t}\n\t\t}\n\n\t\tcreateSeedOpts.Data = bytes.NewReader(body)\n\t}\n\n\tfs := afero.NewOsFs()\n\n\tfilepath, err := seed.CreateSeedFile(fs, createSeedOpts)\n\tif err != nil || filepath == nil {\n\t\treturn errors.E(op, fmt.Errorf(\"failed to create seed file: %w\", err))\n\t}\n\n\to.FilePath = *filepath\n\n\treturn nil\n}\n","sourceCodeStart":151,"sourceCodeEnd":176,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/seed_create.go#L151-L176","documentation":"Returned when seed.CreateSeedFile fails to write the new seed file to disk (afero OS filesystem), or returns a nil path unexpectedly. This is the final write step of `hasura seed create`.","triggerScenarios":"The seeds directory cannot be created or the target file cannot be written: permission denied on the project/seeds directory, disk full, read-only filesystem, or invalid file name characters in the chosen seed name.","commonSituations":"Running the CLI in a directory owned by root, container mounts mounted read-only, CI sandboxes, or a seed name containing path separators.","solutions":["Check write permissions on the project/seeds directory (`ls -ld seeds`) and fix with chown/chmod","Ensure the filesystem is writable (not a read-only mount) and disk has space","Use a simple alphanumeric seed name without slashes or special characters"],"exampleFix":"# before\n$ hasura seed create my/seed  # in read-only dir\n# after\n$ sudo chown -R $USER . && hasura seed create my_seed","handlingStrategy":"validation","validationCode":"// check writability of the seeds directory before creating a seed\nseedsDir := \"seeds\"\nif err := os.MkdirAll(seedsDir, 0o755); err != nil {\n    return fmt.Errorf(\"cannot create seeds dir: %w\", err)\n}\nif f, err := os.CreateTemp(seedsDir, \"*.sql\"); err != nil {\n    return fmt.Errorf(\"seeds dir not writable: %w\", err)\n} else {\n    f.Close()\n    os.Remove(f.Name())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run the CLI as a user that owns the project directory","Keep seed names to [a-z0-9_-]"],"tags":["hasura","seed","filesystem","permissions","cli"],"backgroundTag":"file-write-permission-denied","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}