{"record":{"id":"cb41aff8e8cc7d99","repo":"GoogleContainerTools/jib","slug":"docker-load-command-failed-with-error-getstde","errorCode":null,"errorMessage":"'docker load' command failed with error: + getStderrOutput(dockerProcess)","messagePattern":"'docker load' command failed with error: \\+ getStderrOutput\\(dockerProcess\\)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"jib-core/src/main/java/com/google/cloud/tools/jib/docker/CliDockerClient.java","lineNumber":248,"sourceCode":"      // message from the tarball I/O write failure when reading from stderr fails.\n      String error;\n      try (InputStreamReader stderr =\n          new InputStreamReader(dockerProcess.getErrorStream(), StandardCharsets.UTF_8)) {\n        error = CharStreams.toString(stderr);\n      } catch (IOException ignored) {\n        // This ignores exceptions from reading stderr and uses the original exception from\n        // writing to stdin.\n        error = ex.getMessage();\n      }\n      throw new IOException(\"'docker load' command failed with error: \" + error, ex);\n    }\n\n    try (InputStreamReader stdout =\n        new InputStreamReader(dockerProcess.getInputStream(), StandardCharsets.UTF_8)) {\n      String output = CharStreams.toString(stdout);\n\n      if (dockerProcess.waitFor() != 0) {\n        throw new IOException(\n            \"'docker load' command failed with error: \" + getStderrOutput(dockerProcess));\n      }\n\n      return output;\n    }\n  }\n\n  @Override\n  public void save(\n      ImageReference imageReference, Path outputPath, Consumer<Long> writtenByteCountListener)\n      throws InterruptedException, IOException {\n    Process dockerProcess = docker(\"save\", imageReference.toString());\n\n    try (InputStream stdout = new BufferedInputStream(dockerProcess.getInputStream());\n        OutputStream fileStream = new BufferedOutputStream(Files.newOutputStream(outputPath));\n        NotifyingOutputStream notifyingFileStream =\n            new NotifyingOutputStream(fileStream, writtenByteCountListener)) {\n      ByteStreams.copy(stdout, notifyingFileStream);","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-core/src/main/java/com/google/cloud/tools/jib/docker/CliDockerClient.java#L230-L266","documentation":"CliDockerClient.load() writes the tarball to 'docker load' stdin, then reads stdout and waits for the process. If 'docker load' exits with a nonzero exit code, Jib throws IOException ''docker load' command failed with error: <stderr>'. This is docker itself rejecting the load, reported via its stderr output.","triggerScenarios":"The 'docker load' process spawned by load() terminates with waitFor() != 0 — invalid/corrupt tar archive format, daemon errors, or unsupported archive contents.","commonSituations":"Feeding a non-docker tarball (e.g. an OCI layout or a truncated file) into load(), disk-full during image extraction, or daemon version incompatibilities with the image format.","solutions":["Read the stderr text in the message — it contains docker's actual error","Test 'docker load -i your.tar' manually to confirm and see full output","Re-export the image tarball (docker save / jib build output) and verify it is not truncated","Ensure the docker daemon has sufficient disk space and supports the archive format"],"exampleFix":"// before\ndockerClient.load(badTarball); // nonzero exit\n// after\nPath tar = exportImageTarball(); // regenerate a valid 'docker save'-format tar\nassert Files.size(tar) > 0;\ndockerClient.load(tar);","handlingStrategy":"try-catch","validationCode":"// Sanity-check the archive before load\ntry (var zf = new java.util.zip.ZipFile(tarPath.toFile())) { /* will throw if not a tar/zip */ }\n// better: check manifest.json present via tar listing","typeGuard":null,"tryCatchPattern":"try {\n  dockerClient.load(tarPath);\n} catch (IOException e) {\n  String dockerError = e.getMessage(); // contains docker's stderr\n  throw new ImageLoadFailedException(\"docker rejected archive: \" + dockerError, e);\n}","preventionTips":["Only load tarballs produced by docker save or jib's tar builder","Verify tarball integrity (checksum) after transfer","Ensure daemon disk space is sufficient for the image"],"tags":["docker","docker-load","process","exit-code"],"backgroundTag":"docker-command-failed","analyzedSha":"fb949e2676afbbd7dd7a1ef61e20251931325654","analyzedAt":"2026-09-06T14:04:09.491Z","contentChangedAt":"2026-09-06T14:04:09.491Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}