{"record":{"id":"46ea75ce2ea51cee","repo":"grpc/grpc-java","slug":"cannot-find-bootstrap-configuration-environment-va","errorCode":null,"errorMessage":"Cannot find bootstrap configuration\nEnvironment variables searched:\n- GRPC_XDS_BOOTSTRAP\n- GRPC_XDS_BOOTSTRAP_CONFIG\n\nJava System Properties searched:\n- io.grpc.xds.bootstrap\n- io.grpc.xds.bootstrapConfig\n","messagePattern":"Cannot find bootstrap configuration\nEnvironment variables searched:\n- GRPC_XDS_BOOTSTRAP\n- GRPC_XDS_BOOTSTRAP_CONFIG\n\nJava System Properties searched:\n- io\\.grpc\\.xds\\.bootstrap\n- io\\.grpc\\.xds\\.bootstrapConfig\n","errorType":"exception","errorClass":"XdsInitializationException","httpStatus":null,"severity":"critical","filePath":"xds/src/main/java/io/grpc/xds/GrpcBootstrapperImpl.java","lineNumber":90,"sourceCode":"   *   <li>Environment variable value of \"GRPC_XDS_BOOTSTRAP_CONFIG\"</li>\n   *   <li>Java System Property value of \"io.grpc.xds.bootstrapConfig\"</li>\n   * </ol>\n   */\n  @Override\n  protected String getJsonContent() throws XdsInitializationException, IOException {\n    String jsonContent;\n    String filePath =\n        bootstrapPathFromEnvVar != null ? bootstrapPathFromEnvVar : bootstrapPathFromSysProp;\n    if (filePath != null) {\n      logger.log(XdsLogger.XdsLogLevel.INFO, \"Reading bootstrap file from {0}\", filePath);\n      jsonContent = reader.readFile(filePath);\n      logger.log(XdsLogger.XdsLogLevel.INFO, \"Reading bootstrap from \" + filePath);\n    } else {\n      jsonContent = bootstrapConfigFromEnvVar != null\n          ? bootstrapConfigFromEnvVar : bootstrapConfigFromSysProp;\n    }\n    if (jsonContent == null) {\n      throw new XdsInitializationException(\n          \"Cannot find bootstrap configuration\\n\"\n              + \"Environment variables searched:\\n\"\n              + \"- \" + BOOTSTRAP_PATH_SYS_ENV_VAR + \"\\n\"\n              + \"- \" + BOOTSTRAP_CONFIG_SYS_ENV_VAR + \"\\n\\n\"\n              + \"Java System Properties searched:\\n\"\n              + \"- \" + BOOTSTRAP_PATH_SYS_PROPERTY + \"\\n\"\n              + \"- \" + BOOTSTRAP_CONFIG_SYS_PROPERTY + \"\\n\\n\");\n    }\n\n    return jsonContent;\n  }\n\n  @Override\n  protected Object getImplSpecificConfig(Map<String, ?> serverConfig, String serverUri)\n      throws XdsInitializationException {\n    ConfiguredChannelCredentials configuredChannel = getChannelCredentials(serverConfig, serverUri);\n    return configuredChannel != null ? configuredChannel.channelCredentials() : null;\n  }","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/grpc/grpc-java/blob/64daddc1f3d1975670f769f3e97bde8b2ba32d25/xds/src/main/java/io/grpc/xds/GrpcBootstrapperImpl.java#L72-L108","documentation":"GrpcBootstrapperImpl.getJsonContent locates bootstrap JSON from the file given by GRPC_XDS_BOOTSTRAP (or system property io.grpc.xds.bootstrap) or the inline GRPC_XDS_BOOTSTRAP_CONFIG (io.grpc.xds.bootstrapConfig). If none of these sources yields content, it throws XdsInitializationException listing every location searched. The xDS client cannot start without bootstrap data.","triggerScenarios":"Initializing any xDS-enabled channel/resolver when: the bootstrap env vars and system properties are unset, the referenced file path doesn't exist or is unreadable (in which case parsing falls through), and no inline config is provided.","commonSituations":"Forgetting to set GRPC_XDS_BOOTSTRAP in the container/pod; file path typo or missing volume mount; property set with -D on the wrong JVM; tests running without bootstrap setup.","solutions":["Set GRPC_XDS_BOOTSTRAP_CONFIG (or system property io.grpc.xds.bootstrapConfig) with inline bootstrap JSON.","Or set GRPC_XDS_BOOTSTRAP (io.grpc.xds.bootstrap) to a readable bootstrap file path and verify the file exists at that exact path.","Enable XdsLogger INFO logs to see which bootstrap path was attempted and why it wasn't used.","For GKE with CSM/metadata servers, ensure the environment actually provides the bootstrap (Workload/Mesh CA setup) or supply it manually."],"exampleFix":"// before — starting the channel with no bootstrap anywhere\nManagedChannel.forTarget(\"xds://...\").build();\n// after\n// export GRPC_XDS_BOOTSTRAP=/etc/grpc/bootstrap.json  (file exists and is readable)\nManagedChannel.forTarget(\"xds://...\").build();","handlingStrategy":"validation","validationCode":"// run before creating an xds:// channel\nString path = System.getenv(\"GRPC_XDS_BOOTSTRAP\");\nString inline = System.getenv(\"GRPC_XDS_BOOTSTRAP_CONFIG\");\nif (inline == null && (path == null || !java.nio.file.Files.isReadable(java.nio.file.Path.of(path)))) {\n  throw new IllegalStateException(\"No xDS bootstrap: set GRPC_XDS_BOOTSTRAP or GRPC_XDS_BOOTSTRAP_CONFIG\");\n}","typeGuard":null,"tryCatchPattern":"try { /* init xDS */ } catch (XdsInitializationException e) { if (e.getMessage().startsWith(\"Cannot find bootstrap configuration\")) { log.error(\"Set GRPC_XDS_BOOTSTRAP/GRPC_XDS_BOOTSTRAP_CONFIG\"); } }","preventionTips":["Set GRPC_XDS_BOOTSTRAP or GRPC_XDS_BOOTSTRAP_CONFIG in every environment (pods, CI) that uses xds:// targets","Verify the bootstrap file exists and is readable at the exact configured path","Remember system properties io.grpc.xds.bootstrap/bootstrapConfig as alternatives","Log bootstrap resolution at INFO when debugging startup"],"tags":["xds","bootstrap","env-var","config-file"],"backgroundTag":"missing-env-var","analyzedSha":"64daddc1f3d1975670f769f3e97bde8b2ba32d25","analyzedAt":"2026-09-08T06:14:57.704Z","contentChangedAt":"2026-09-08T06:14:57.704Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}