{"record":{"id":"ba08137a070129f1","repo":"GoogleContainerTools/jib","slug":"failed-to-create-open-or-parse-global-jib-config","errorCode":null,"errorMessage":"Failed to create, open, or parse global Jib config file; see https://github.com/GoogleContainerTools/jib/blob/master/docs/faq.md#where-is-the-global-jib-configuration-file-and-how-i-can-configure-it to fix or you may need to delete ${configFile}","messagePattern":"Failed to create, open, or parse global Jib config file; see https://github\\.com/GoogleContainerTools/jib/blob/master/docs/faq\\.md#where-is-the-global-jib-configuration-file-and-how-i-can-configure-it to fix or you may need to delete (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/globalconfig/GlobalConfig.java","lineNumber":77,"sourceCode":"      try (OutputStream outputStream = Files.newOutputStream(tempConfigFile)) {\n        JsonTemplateMapper.writeTo(configJson, outputStream);\n        Files.move(tempConfigFile, configFile);\n        return from(configJson);\n\n      } catch (FileAlreadyExistsException ex) {\n        // Perhaps created concurrently. Read again.\n        return readConfig(configDir);\n      }\n\n    } catch (InvalidGlobalConfigException ex) {\n      throw new InvalidGlobalConfigException(\n          ex.getMessage()\n              + \"; see https://github.com/GoogleContainerTools/jib/blob/master/docs/faq.md#where-is-the-global-jib-configuration-file-and-how-i-can-configure-it \"\n              + \"to fix or you may need to delete \"\n              + configFile);\n\n    } catch (IOException ex) {\n      throw new IOException(\n          \"Failed to create, open, or parse global Jib config file; see \"\n              + \"https://github.com/GoogleContainerTools/jib/blob/master/docs/faq.md#where-is-the-global-jib-configuration-file-and-how-i-can-configure-it \"\n              + \"to fix or you may need to delete \"\n              + configFile,\n          ex);\n    }\n  }\n\n  private static GlobalConfig from(GlobalConfigTemplate configJson)\n      throws InvalidGlobalConfigException {\n    ImmutableListMultimap.Builder<String, String> registryMirrors = ImmutableListMultimap.builder();\n    for (RegistryMirrorsTemplate mirrorConfig : configJson.getRegistryMirrors()) {\n      // validation\n      if (Strings.isNullOrEmpty(mirrorConfig.getRegistry())) {\n        throw new InvalidGlobalConfigException(\"'registryMirrors.registry' property is missing\");\n      }\n      if (mirrorConfig.getMirrors().isEmpty()) {\n        throw new InvalidGlobalConfigException(\"'registryMirrors.mirrors' property is missing\");","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/globalconfig/GlobalConfig.java#L59-L95","documentation":"Jib throws an IOException with this message when it cannot create, open, or parse the global Jib configuration file (~/.jib/jib-config.json), wrapping the original exception. The appended FAQ link explains where the file lives and that deleting it usually resolves the problem.","triggerScenarios":"The catch (IOException ex) branch of GlobalConfig.readConfig: filesystem errors creating/reading the file (bad permissions, disk issues), or parsing errors from reading the JSON template.","commonSituations":"Read-only or permission-restricted home directory; ~/.jib exists as a file instead of a directory; corrupted config file that fails JSON parsing; disk full or NFS/permission issues in CI containers.","solutions":["Delete the global config file shown in the message so Jib regenerates defaults","Check permissions on ~/.jib and the config file (must be readable/writable by the build user)","If ~/.jib is a directory-where-file or file-where-directory, fix its type","Repair the JSON content per the linked FAQ"],"exampleFix":"// before (shell)\nls -l ~/.jib/jib-config.json   # unreadable, owned by root\n// after\nsudo chown $(whoami) ~/.jib/jib-config.json\n# or simply remove it to regenerate:\nrm ~/.jib/jib-config.json","handlingStrategy":"try-catch","validationCode":"// Pre-check readability before invoking Jib\njava.nio.file.Path cfg = java.nio.file.Path.of(System.getProperty(\"user.home\"), \".jib\", \"jib-config.json\");\nif (java.nio.file.Files.exists(cfg) && !java.nio.file.Files.isReadable(cfg)) {\n  throw new IllegalStateException(\"Global Jib config not readable: \" + cfg);\n}","typeGuard":null,"tryCatchPattern":"try {\n  GlobalConfig.readConfig(configDir);\n} catch (IOException e) {\n  logger.warn(\"Deleting unreadable/corrupt global Jib config: {}\", e.getMessage());\n  Files.deleteIfExists(configDir.resolve(\"jib-config.json\"));\n  GlobalConfig.readConfig(configDir);\n}","preventionTips":["Ensure the build user owns ~/.jib and its files","Do not run Jib builds as root while your home is another user's","Verify ~/.jib is a directory, and jib-config.json is valid JSON"],"tags":["jib","config","io","file-read"],"backgroundTag":"file-read-failed","analyzedSha":"fb949e2676afbbd7dd7a1ef61e20251931325654","analyzedAt":"2026-09-06T14:04:09.491Z","contentChangedAt":"2026-09-06T14:04:09.491Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}