{"record":{"id":"2cc634933d306d6e","repo":"alibaba/nacos","slug":"http-result-getstatuscode-when-fetching-2cc634","errorCode":null,"errorMessage":"HTTP  + result.getStatusCode() +  when fetching  + url","messagePattern":"HTTP  \\+ result\\.getStatusCode\\(\\) \\+  when fetching  \\+ url","errorType":"http","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"plugin-default-impl/nacos-default-ai-importer-plugin/src/main/java/com/alibaba/nacos/plugin/ai/importer/defaultimpl/skill/SkillWellKnownImportService.java","lineNumber":531,"sourceCode":"    private String trimTrailingSlash(String value) throws NacosException {\n        if (StringUtils.isBlank(value)) {\n            throw invalid(\"Skill well-known import source endpoint must not be empty.\");\n        }\n        return trimTrailingSlashUnchecked(value);\n    }\n    \n    private String trimTrailingSlashUnchecked(String value) {\n        String result = value.trim();\n        while (result.endsWith(\"/\")) {\n            result = result.substring(0, result.length() - 1);\n        }\n        return result;\n    }\n    \n    private byte[] fetchBytes(String url) throws Exception {\n        ImportHttpResponse result = fetchUrl(url);\n        if (!result.isSuccess()) {\n            throw new IllegalStateException(\n                \"HTTP \" + result.getStatusCode() + \" when fetching \" + url);\n        }\n        return result.getBody();\n    }\n    \n    private ImportHttpResponse fetchUrl(String url) throws Exception {\n        return httpClient.get(url, DEFAULT_READ_TIMEOUT_SECONDS, \"*/*\");\n    }\n    \n    private WellKnownIndexVersion resolveVersion(WellKnownSkillsIndex index)\n        throws NacosException {\n        String schema = index.getSchema();\n        if (StringUtils.isBlank(schema) || StringUtils.equals(schema, SCHEMA_0_1)\n            || schema.contains(\"/0.1.0/\")) {\n            return WellKnownIndexVersion.V0_1_0;\n        }\n        if (StringUtils.equals(schema, SCHEMA_0_2) || schema.contains(\"/0.2.0/\")) {\n            return WellKnownIndexVersion.V0_2_0;","sourceCodeStart":513,"sourceCodeEnd":549,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/plugin-default-impl/nacos-default-ai-importer-plugin/src/main/java/com/alibaba/nacos/plugin/ai/importer/defaultimpl/skill/SkillWellKnownImportService.java#L513-L549","documentation":"Thrown by SkillWellKnownImportService.fetchBytes() as an IllegalStateException when a raw byte fetch (used for index documents or remote references) returns a non-success HTTP status. The message includes the status code and the requested URL.","triggerScenarios":"fetchUrl(url) returns a response where result.isSuccess() is false; the throw fires before result.getBody() is returned. Used for resolving well-known index JSON or supplementary resources during skill import.","commonSituations":"The well-known index URL is unreachable (404/5xx); the skill source host is down; a relative reference resolved to an invalid absolute URL; network egress restrictions blocking the host.","solutions":["Open the URL shown in the message directly (curl -I) to see the actual response.","Correct the source URL / allow-list the host in network egress rules.","Retry transient failures; for persistent errors, point the import at a different/cached source."],"exampleFix":"// before\nString url = \"https://example.invalid/.well-known/skills.json\";\n\n// after\nString url = \"https://example.com/.well-known/skills.json\";","handlingStrategy":"retry","validationCode":"ImportHttpResponse probe = fetchUrl(url);\nif (!probe.isSuccess()) {\n    throw new IllegalStateException(\"Source unreachable: HTTP \" + probe.getStatusCode() + \" @ \" + url);\n}","typeGuard":null,"tryCatchPattern":"try {\n    return fetchBytes(url);\n} catch (IllegalStateException e) {\n    if (e.getMessage().startsWith(\"HTTP 5\") && attempt < maxRetries) { /* retry */ }\n    throw e;\n}","preventionTips":["Pin well-known index/source URLs to stable, highly-available hosts.","Retry transient 5xx with backoff; treat 4xx as permanent.","Network-egress-allow the skill source hosts."],"tags":["ai-registry","skill","network","http","importer"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}