{"record":{"id":"92021c22ae195082","repo":"spring-projects/spring-ai","slug":"java-io-ioexception-92021c","errorCode":null,"errorMessage":"java.io.IOException","messagePattern":"java\\.io\\.IOException","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"models/spring-ai-vertex-ai-embedding/src/main/java/org/springframework/ai/vertexai/embedding/VertexAiEmbeddingConnectionDetails.java","lineNumber":179,"sourceCode":"\t\t\t\t\tthis.location = DEFAULT_LOCATION;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis.endpoint = this.location + DEFAULT_ENDPOINT_SUFFIX;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!StringUtils.hasText(this.publisher)) {\n\t\t\t\tthis.publisher = DEFAULT_PUBLISHER;\n\t\t\t}\n\n\t\t\tif (this.predictionServiceSettings == null) {\n\t\t\t\ttry {\n\t\t\t\t\tthis.predictionServiceSettings = PredictionServiceSettings.newBuilder()\n\t\t\t\t\t\t.setEndpoint(this.endpoint)\n\t\t\t\t\t\t.build();\n\t\t\t\t}\n\t\t\t\tcatch (IOException e) {\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tAssert.state(this.location != null, \"location must not be null\");\n\t\t\treturn new VertexAiEmbeddingConnectionDetails(this.projectId, this.location, this.publisher,\n\t\t\t\t\tthis.predictionServiceSettings);\n\t\t}\n\n\t}\n\n}\n","sourceCodeStart":161,"sourceCodeEnd":191,"githubUrl":"https://github.com/spring-projects/spring-ai/blob/98a7beda4f29d80a71c5837eb4053b03a93a46f7/models/spring-ai-vertex-ai-embedding/src/main/java/org/springframework/ai/vertexai/embedding/VertexAiEmbeddingConnectionDetails.java#L161-L191","documentation":"VertexAiEmbeddingConnectionDetails.Builder.build() constructs PredictionServiceSettings with the configured endpoint; this performs validation/IO that can throw IOException (bad endpoint format, failed credential/settings resolution). The builder wraps it in a RuntimeException, aborting construction of the connection details.","triggerScenarios":"Calling VertexAiEmbeddingConnectionDetails.newBuilder()...build() where PredictionServiceSettings.newBuilder().setEndpoint(endpoint).build() throws IOException — typically an invalid or unreachable endpoint value or problems resolving default settings/credentials.","commonSituations":"Typo in the endpoint (must be in the form <region>-aiplatform.googleapis.com:443); endpoint set to a full https:// URL when the client expects host:port; credential scoping failing while building default settings; network restrictions during settings initialization.","solutions":["Set the endpoint to the canonical Vertex AI format, e.g. \"us-central1-aiplatform.googleapis.com:443\" (no scheme).","Check that the wrapped IOException cause details the actual settings resolution problem and fix accordingly.","Verify Google Cloud credentials (GOOGLE_APPLICATION_CREDENTIALS / ADC) are valid before building.","Ensure outbound network access to googleapis.com from the runtime."],"exampleFix":"// before\nVertexAiEmbeddingConnectionDetails.newBuilder()\n    .withEndpoint(\"https://us-central1-aiplatform.googleapis.com\")\n    .build();\n// after\nVertexAiEmbeddingConnectionDetails.newBuilder()\n    .withEndpoint(\"us-central1-aiplatform.googleapis.com:443\")\n    .build();","handlingStrategy":"validation","validationCode":"String endpoint = \"us-central1-aiplatform.googleapis.com:443\";\nif (!endpoint.matches(\"[a-z0-9-]+-aiplatform\\\\.googleapis\\\\.com:443\")) {\n    throw new IllegalArgumentException(\"Vertex AI endpoint must be <region>-aiplatform.googleapis.com:443\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    details = VertexAiEmbeddingConnectionDetails.newBuilder()\n        .withProjectId(projectId).withLocation(location).withEndpoint(endpoint).build();\n} catch (RuntimeException e) {\n    if (e.getCause() instanceof IOException io) {\n        throw new IllegalStateException(\"Vertex settings build failed: \" + io.getMessage(), io);\n    }\n    throw e;\n}","preventionTips":["Use the host:port endpoint form (no https:// scheme).","Ensure Application Default Credentials / GOOGLE_APPLICATION_CREDENTIALS are set.","Confirm outbound network access to googleapis.com."],"tags":["gcp","vertex-ai","configuration","endpoint"],"backgroundTag":"invalid-config-value","analyzedSha":"98a7beda4f29d80a71c5837eb4053b03a93a46f7","analyzedAt":"2026-09-11T14:15:49.441Z","contentChangedAt":"2026-09-11T14:15:49.441Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}