dgraph-io/dgraph · error

No data files found in %s

Error message

No data files found in %s

What it means

After scanning the given location with filestore.FindDataFiles for .rdf, .rdf.gz, .json and .json.gz files, the loader found zero files and aborts. The location was supplied but did not resolve to any supported data file.

Source

Thrown at dgraph/cmd/live/run.go:788

		}
		fmt.Printf("Processed schema file %q\n\n", opt.schemaFile)
	}

	if l.schema, err = getSchema(ctx, dg, rootNsOperation); err != nil {
		fmt.Printf("Error while loading schema from alpha %s\n", err)
		return err
	}

	if opt.dataFiles == "" {
		return errors.New("RDF or JSON file(s) location must be specified")
	}

	fs := filestore.NewFileStore(opt.dataFiles)

	filesList := fs.FindDataFiles(opt.dataFiles, []string{".rdf", ".rdf.gz", ".json", ".json.gz"})
	totalFiles := len(filesList)
	if totalFiles == 0 {
		return errors.Errorf("No data files found in %s", opt.dataFiles)
	}
	fmt.Printf("Found %d data file(s) to process\n", totalFiles)

	errCh := make(chan error, totalFiles)
	for _, file := range filesList {
		file = strings.Trim(file, " \t")
		go func(file string) {
			errCh <- errors.Wrap(l.processFile(ctx, fs, file, opt.key), file)
		}(file)
	}

	// PrintCounters should be called after schema has been updated.
	if bmOpts.PrintCounters {
		go l.printCounters()
	}

	for range totalFiles {
		if err := <-errCh; err != nil {

View on GitHub (pinned to 759e242be6)

Solutions

  1. Verify the path exists and contains files with .rdf/.rdf.gz/.json/.json.gz extensions
  2. Fix the --files value to point at actual data files or a directory that holds them
  3. Rename files to a supported extension (e.g. .gzip -> .gz, .JSON -> .json)
  4. Test with `ls <path>/*.rdf` or similar to confirm the glob/path resolves

Example fix

// before
dgraph live --files /data/export/   # only contains .txt
// after
mv /data/export/dump.gzip /data/export/dump.json.gz
dgraph live --files /data/export/dump.json.gz
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check the location for supported extensions before loading
import { readdirSync } from 'fs';
const supported = /\.(rdf|json)(\.gz)?$/;
const found = readdirSync(dir).filter(f => supported.test(f));
if (found.length === 0) throw new Error(`No .rdf/.json(.gz) files found in ${dir}`);

Type guard

function hasSupportedDataFiles(list) {
  return Array.isArray(list) && list.some(f => /\.(rdf|json)(\.gz)?$/.test(f));
}

Try / catch

try {
  await runLive({ files: dir });
} catch (e) {
  if (String(e.message).startsWith('No data files found')) {
    console.error('Path resolved but no .rdf/.rdf.gz/.json/.json.gz files; fix path or extensions');
  } else { throw e; }
}

Prevention

When it happens

Trigger: --files points to a directory containing only unsupported extensions; the path is wrong or empty; files exist but with extensions like .txt/.xml or double extensions not in the recognized list; an HTTP/S3 URL that yields no matches.

Common situations: Typos in directory paths; files named data.RDF (extension matching is exact-case); gzipped files named .gzip instead of .gz; remote bucket paths mounted incorrectly.

Related errors


AI-assisted analysis of dgraph-io/dgraph@759e242be6 (2026-09-01). Data as JSON: /api/errors/5921b2650622f80e. Report an issue: GitHub.