juicedata/juicefs · error · IllegalArgumentException

No sources given

Error message

No sources given

What it means

Thrown by concat() when the srcs array is empty. Concatenating zero source files is meaningless, so the method validates input before making the native jfs_concat call and fails fast with IllegalArgumentException.

Source

Thrown at sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java:1607

    } else {
      return new MD5MD5CRC32GzipFileChecksum(bytesPerCrc, crcPerBlock, md5);
    }
  }

  @Override
  public void concat(final Path dst, final Path[] srcs) throws IOException {
    if (needCheckPermission()) {
      access(dst.getParent(), FsAction.WRITE);
      access(dst, FsAction.WRITE);
      for (Path src : srcs) {
        access(src, FsAction.READ);
      }
      superGroupFileSystem.concat(dst, srcs);
      return;
    }
    statistics.incrementWriteOps(1);
    if (srcs.length == 0) {
      throw new IllegalArgumentException("No sources given");
    }
    Path dp = makeQualified(dst).getParent();
    for (Path src : srcs) {
      if (!makeQualified(src).getParent().equals(dp)) {
        throw new HadoopIllegalArgumentException("Source file " + normalizePath(src)
                + " is not in the same directory with the target "
                + normalizePath(dst));
      }
    }
    byte[][] srcbytes = new byte[srcs.length][];
    int bufsize = 0;
    for (int i = 0; i < srcs.length; i++) {
      srcbytes[i] = normalizePath(srcs[i]).getBytes("UTF-8");
      bufsize += srcbytes[i].length + 1;
    }
    Pointer buf = Memory.allocate(Runtime.getRuntime(lib), bufsize);
    long offset = 0;
    for (int i = 0; i < srcs.length; i++) {

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Guard the call: if (srcs.length > 0) fs.concat(dst, srcs)
  2. Skip concat entirely (and create an empty dst) when no sources exist
  3. Fix the upstream filtering that emptied the source list
  4. Log the source list before concat to catch empty input early

Example fix

// before
fs.concat(dst, srcs);
// after
if (srcs != null && srcs.length > 0) { fs.concat(dst, srcs); }
Defensive patterns

Strategy: validation

Validate before calling

if (srcs == null || srcs.length == 0) throw new IllegalArgumentException("concat requires at least one source");

Type guard

boolean hasSources(Path[] srcs) { return srcs != null && srcs.length > 0; }

Prevention

When it happens

Trigger: fs.concat(dst, new Path[0]); building the source list with a filter that removed all entries; passing a null- or empty-sized collection converted to an array.

Common situations: Batch jobs where all source files were already consumed/deleted by a previous run; incorrect partition handling yielding no parts to merge; copy-paste bug passing wrong variable.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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