{"record":{"id":"7b4253042bf1a6c2","repo":"GoogleContainerTools/jib","slug":"docker-load-command-failed-with-error-error","errorCode":null,"errorMessage":"'docker load' command failed with error: + error","messagePattern":"'docker load' command failed with error: \\+ error","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"jib-core/src/main/java/com/google/cloud/tools/jib/docker/CliDockerClient.java","lineNumber":240,"sourceCode":"    Process dockerProcess = docker(\"load\");\n\n    try (NotifyingOutputStream stdin =\n        new NotifyingOutputStream(dockerProcess.getOutputStream(), writtenByteCountListener)) {\n      imageTarball.writeTo(stdin);\n\n    } catch (IOException ex) {\n      // Tries to read from stderr. Not using getStderrOutput(), as we want to show the error\n      // 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)","sourceCodeStart":222,"sourceCodeEnd":258,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-core/src/main/java/com/google/cloud/tools/jib/docker/CliDockerClient.java#L222-L258","documentation":"CliDockerClient.load() pipes an image tarball into 'docker load' via the process stdin. If writing to the process stdin throws an IOException, Jib reads whatever stderr it can and throws IOException ''docker load' command failed with error: <error>', chaining the original exception. It indicates the load operation failed at the stdin-piping stage.","triggerScenarios":"docker loadProcess stdin write fails — the docker process died or closed stdin early (e.g. docker CLI crashed, was killed, or rejected the input), causing the ByteStreams/stdin write inside load() to throw before the normal exit-code check.","commonSituations":"Docker daemon restarting mid-load, out-of-disk conditions killing the CLI, invalid or corrupted image tarball causing docker to exit abruptly, or docker CLI not installed/permission problems.","solutions":["Check the chained cause and stderr text in the message for docker's own error","Run 'docker load < image.tar' manually with the same tarball to reproduce and see docker's error","Verify the docker daemon is running ('docker info') and retry","Regenerate/validate the image tarball; check disk space on the host"],"exampleFix":"// before\ndockerClient.load(imageTarballPath); // IOException: 'docker load' command failed...\n// after\ntry {\n  dockerClient.load(imageTarballPath);\n} catch (IOException e) {\n  throw new BuildStepFailedException(\n      \"docker load failed (daemon running? tarball valid?): \" + e.getMessage(), e);\n}","handlingStrategy":"try-catch","validationCode":"// Validate the tarball exists and looks like a docker archive before load\nif (!Files.isRegularFile(tarPath) || Files.size(tarPath) == 0)\n  throw new IllegalArgumentException(\"Invalid image tarball: \" + tarPath);","typeGuard":null,"tryCatchPattern":"try {\n  dockerClient.load(tarPath);\n} catch (IOException e) {\n  // chained cause holds the stdin-write failure; stderr in the message\n  throw new ImageLoadFailedException(e.getMessage(), e.getCause());\n}","preventionTips":["Verify the tarball is a docker save archive (tar tf file.tar | grep manifest.json)","Check free disk space before large loads","Keep the daemon running/stable during the operation"],"tags":["docker","docker-load","process","io"],"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"}