{"record":{"id":"af88080e361ab827","repo":"dgraph-io/dgraph","slug":"rdf-or-json-file-s-location-must-be-specified","errorCode":null,"errorMessage":"RDF or JSON file(s) location must be specified","messagePattern":"RDF or JSON file\\(s\\) location must be specified","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"dgraph/cmd/live/run.go","lineNumber":780,"sourceCode":"\t\terr := l.processSchemaFile(ctx, opt.schemaFile, opt.key, dg)\n\t\tif err != nil {\n\t\t\tif err == context.Canceled {\n\t\t\t\tfmt.Printf(\"Interrupted while processing schema file %q\\n\", opt.schemaFile)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tfmt.Printf(\"Error while processing schema file %q: %s\\n\", opt.schemaFile, err)\n\t\t\treturn err\n\t\t}\n\t\tfmt.Printf(\"Processed schema file %q\\n\\n\", opt.schemaFile)\n\t}\n\n\tif l.schema, err = getSchema(ctx, dg, rootNsOperation); err != nil {\n\t\tfmt.Printf(\"Error while loading schema from alpha %s\\n\", err)\n\t\treturn err\n\t}\n\n\tif opt.dataFiles == \"\" {\n\t\treturn errors.New(\"RDF or JSON file(s) location must be specified\")\n\t}\n\n\tfs := filestore.NewFileStore(opt.dataFiles)\n\n\tfilesList := fs.FindDataFiles(opt.dataFiles, []string{\".rdf\", \".rdf.gz\", \".json\", \".json.gz\"})\n\ttotalFiles := len(filesList)\n\tif totalFiles == 0 {\n\t\treturn errors.Errorf(\"No data files found in %s\", opt.dataFiles)\n\t}\n\tfmt.Printf(\"Found %d data file(s) to process\\n\", totalFiles)\n\n\terrCh := make(chan error, totalFiles)\n\tfor _, file := range filesList {\n\t\tfile = strings.Trim(file, \" \\t\")\n\t\tgo func(file string) {\n\t\t\terrCh <- errors.Wrap(l.processFile(ctx, fs, file, opt.key), file)\n\t\t}(file)\n\t}","sourceCodeStart":762,"sourceCodeEnd":798,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/dgraph/cmd/live/run.go#L762-L798","documentation":"`dgraph live` requires a data file location via the --files (dataFiles) flag and refuses to start a load with none specified. After the schema is fetched from the Alpha, an empty opt.dataFiles triggers this plain error and aborts the run before any file scanning occurs.","triggerScenarios":"Running `dgraph live` without the --files flag; passing an empty string for --files (e.g. --files \"\" in a script where a variable failed to expand).","commonSituations":"Shell scripts where $DATA_FILE is unset/empty; interactive users who only passed --schema (schema alone is not enough); CI pipelines where an artifact path variable is missing.","solutions":["Pass the data file(s) with --files, e.g. `dgraph live --files data.rdf`","Fix the shell variable so it expands to the actual RDF/JSON path before invoking dgraph live","Glob multiple files: `--files \"dir/*.rdf\"`"],"exampleFix":"// before (no data)\ndgraph live --alpha alpha:9080 --schema schema.txt\n// after\ndgraph live --alpha alpha:9080 --schema schema.txt --files ./data.rdf","handlingStrategy":"validation","validationCode":"// Validate the files argument before invoking dgraph live\nif (!opts.files || opts.files.trim() === '') {\n  throw new Error('dgraph live requires --files pointing to RDF/JSON data');\n}","typeGuard":"function hasDataFilesArg(opts) {\n  return typeof opts.files === 'string' && opts.files.trim().length > 0;\n}","tryCatchPattern":"try {\n  await runLive(args);\n} catch (e) {\n  if (String(e.message).includes('RDF or JSON file(s) location must be specified')) {\n    console.error('Set --files (e.g. --files data.rdf) and re-run');\n  } else { throw e; }\n}","preventionTips":["Always pass --files in load scripts; fail fast on empty env variables with ${DATA:?}","Require both --schema and --files in shared wrapper scripts","Echo the resolved file variable before invoking the CLI"],"tags":["cli","missing-argument","configuration"],"backgroundTag":"missing-required-argument","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}