hasura/graphql-engine · error
no data provided
Error message
no data provided
What it means
CreateSeedFile refuses to create a seed file when opts.Data is nil, since it has no content to write. This is an argument-validation error: the caller must always supply a non-nil io.Reader (the data to seed) before a timestamped <timestamp>_<name>.sql file can be generated.
Source
Thrown at cli/seed/create.go:34
"github.com/spf13/afero"
)
// CreateSeedOpts has the list of options required
// to create a seed file.
type CreateSeedOpts struct {
UserProvidedSeedName string
// DirectoryPath in which seed file should be created
DirectoryPath string
Data io.Reader
Database string
}
// CreateSeedFile creates a .sql file according to the arguments
// it'll return full filepath and an error if any.
func CreateSeedFile(fs afero.Fs, opts CreateSeedOpts) (*string, error) {
var op internalerrors.Op = "seed.CreateSeedFile"
if opts.Data == nil {
return nil, internalerrors.E(op, errors.New("no data provided"))
}
const fileExtension = "sql"
timestamp := strconv.FormatInt(time.Now().UnixNano()/int64(time.Millisecond), 10)
// filename will be in format <timestamp>_<userProvidedSeedName>.sql
filenameWithTimeStamp := fmt.Sprintf(
"%s_%s.%s",
timestamp,
opts.UserProvidedSeedName,
fileExtension,
)
fullFilePath := filepath.Join(
filepath.Join(opts.DirectoryPath, opts.Database),
filenameWithTimeStamp,
)
// Write contents to fileView on GitHub (pinned to 724551b9ae)
Solutions
- Always set CreateSeedOpts.Data to a non-nil io.Reader (e.g. the result of ExportDatadump or the open source file)
- Check for nil before calling and fail early with a clearer message upstream
- If Data comes from another step, verify that step succeeded before creating the seed file
Example fix
// before
opts := seed.CreateSeedOpts{ SeedName: "demo" }
path, err := seed.CreateSeedFile(fs, opts)
// after
opts := seed.CreateSeedOpts{ SeedName: "demo", Data: bytes.NewReader(sqlBytes) }
path, err := seed.CreateSeedFile(fs, opts) Defensive patterns
Strategy: validation
Validate before calling
if opts.Data == nil {
return errors.New("refusing to create seed: opts.Data is required")
}
path, err := seed.CreateSeedFile(fs, opts) Type guard
func hasSeedData(opts seed.CreateSeedOpts) bool {
return opts.Data != nil
} Prevention
- Construct CreateSeedOpts in one place with a mandatory Data assignment
- Lint/test for nil Data in unit tests around seed creation
When it happens
Trigger: Calling seed.CreateSeedFile(fs, CreateSeedOpts{...}) without setting the Data field, or passing a nil *os.File / nil reader as the export source.
Common situations: Building a seed programmatically and forgetting the Data field, refactoring away the file-reading code that used to populate Data, or a nil pointer from a previous failed operation being forwarded.
Related errors
- expected extension to be one of %v but got %s on file %s
- invalid schema/table provided "%s"
- framework %s is not found
- starter kit is not available for framework %s
- unknown shell: %s. Use bash or zsh
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/4f48fa0c911f3089.
Report an issue: GitHub.