juicedata/juicefs · error · RuntimeException

Cannot create file system.

Error message

Cannot create file system.

What it means

TestDFSIO.configure resolves the benchmark's FileSystem from test.basedir via new Path(baseDir).getFileSystem(conf) inside a try block; any IOException is rethrown as a RuntimeException "Cannot create file system.". This is the setup-time filesystem acquisition for the benchmark and failing it aborts before any I/O runs.

Source

Thrown at sdk/java/src/main/java/io/juicefs/bench/TestDFSIO.java:479

    }

    public byte[] getBuffer() {
      if (randomBytes) {
        random.nextBytes(buffer.get());
      }
      return buffer.get();
    }

    @Override // Mapper
    public void configure(JobConf conf) {
      super.configure(conf);
      bufferSize = conf.getInt("test.io.file.buffer.size", 4096);
      buffer = ThreadLocal.withInitial(() -> new byte[bufferSize]);
      try {
        baseDir = conf.get("test.basedir");
        fs = new Path(baseDir).getFileSystem(conf);
      } catch (IOException e) {
        throw new RuntimeException("Cannot create file system.", e);
      }
      randomBytes = conf.getBoolean("test.randomBytes", false);

      // grab compression
      String compression = getConf().get("test.io.compression.class", null);
      Class<? extends CompressionCodec> codec;

      // try to initialize codec
      try {
        codec = (compression == null) ? null :
                Class.forName(compression).asSubclass(CompressionCodec.class);
      } catch (Exception e) {
        throw new RuntimeException("Compression codec not found: ", e);
      }

      if (codec != null) {
        compressionCodec = (CompressionCodec)
                ReflectionUtils.newInstance(codec, getConf());

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Set a valid basedir, e.g. -baseDir jfs://myvol/TestDFSIO (populates test.basedir).
  2. Ensure the filesystem plugin for the basedir scheme is on the classpath with its impl config keys set (fs.jfs.impl for JuiceFS).
  3. Inspect the wrapped IOException cause for the true failure (missing class, bad URI, config parse) and fix it.
  4. Verify with a local path (file:///tmp/testdfsio) to separate config issues from benchmark code.

Example fix

// before
TestDFSIO -write -size 1GB            // no basedir -> RuntimeException
// after
TestDFSIO -write -baseDir jfs://myvol/TestDFSIO -size 1GB
Defensive patterns

Strategy: validation

Validate before calling

String baseDir = conf.get("test.basedir");
if (baseDir == null || baseDir.isEmpty()) throw new IllegalArgumentException("-baseDir is required for TestDFSIO");
new Path(baseDir).getFileSystem(conf); // dry-run resolution

Try / catch

try {
  runTestDFSIO(args);
} catch (RuntimeException e) {
  if ("Cannot create file system.".equals(e.getMessage())) {
    throw new IllegalArgumentException("check -baseDir and FS plugin (fs.jfs.impl)", e.getCause());
  }
  throw e;
}

Prevention

When it happens

Trigger: Running TestDFSIO where test.basedir is unset (conf.get returns null, Path("null") resolution fails) or its scheme has no FileSystem implementation, or the FS constructor throws IOException (e.g. missing plugin class wired via config).

Common situations: Running TestDFSIO against jfs:// without the JuiceFS Hadoop jar and fs.jfs.impl configured; launching from an environment where test.basedir was never set (forgotten -baseDir); HADOOP conf not propagated to the mapper tasks.

Understand the failure class

Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.

Related errors


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/831a97b6b6bc45e4. Report an issue: GitHub.