{"record":{"id":"b2c9a514b2596925","repo":"alibaba/nacos","slug":"http-result-getstatuscode-when-fetching","errorCode":null,"errorMessage":"HTTP  + result.getStatusCode() +  when fetching  + result.getUrl()","messagePattern":"HTTP  \\+ result\\.getStatusCode\\(\\) \\+  when fetching  \\+ result\\.getUrl\\(\\)","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":348,"sourceCode":"        ImportHttpResponse artifact = fetchVersion020Artifact(resolvedIndex, entry);\n        if (TYPE_SKILL_MD.equals(type)) {\n            return toSingleMarkdownSkillZip(entry.getName(), artifact.getBody());\n        }\n        if (TYPE_ARCHIVE.equals(type)) {\n            return toSkillZipFromArchive(artifact);\n        }\n        throw invalid(\"Unsupported Skill well-known distribution type: \" + entry.getType());\n    }\n    \n    private ImportHttpResponse fetchVersion020Artifact(ResolvedWellKnownIndex resolvedIndex,\n        WellKnownSkillEntry entry) throws Exception {\n        if (StringUtils.isBlank(entry.getUrl())) {\n            throw invalid(\"Skill well-known 0.2.0 entry url must not be empty.\");\n        }\n        ImportHttpResponse result =\n            fetchUrl(resolveArtifactUrl(resolvedIndex.getIndexUrl(), entry.getUrl()));\n        if (!result.isSuccess()) {\n            throw new IllegalStateException(\n                \"HTTP \" + result.getStatusCode() + \" when fetching \" + result.getUrl());\n        }\n        checkDownloadedSize(result.getBody());\n        verifySha256Digest(entry.getDigest(), result.getBody());\n        return result;\n    }\n    \n    private byte[] toSingleMarkdownSkillZip(String skillName, byte[] markdown) throws Exception {\n        ByteArrayOutputStream output = new ByteArrayOutputStream();\n        try (ZipOutputStream zip = new ZipOutputStream(output, StandardCharsets.UTF_8)) {\n            zip.putNextEntry(new ZipEntry(skillName + \"/\" + MARKDOWN_FILE));\n            zip.write(markdown);\n            zip.closeEntry();\n        }\n        return output.toByteArray();\n    }\n    \n    private byte[] toSkillZipFromArchive(ImportHttpResponse artifact) throws Exception {","sourceCodeStart":330,"sourceCodeEnd":366,"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#L330-L366","documentation":"Thrown by SkillWellKnownImportService.fetchVersion020Artifact() as an IllegalStateException when fetching a Skill well-known 0.2.0 artifact (the downloadable skill payload referenced by an index entry) returns a non-success HTTP status. The message includes the status code and the resolved artifact URL.","triggerScenarios":"During a 0.2.0 skill import, fetchUrl(resolveArtifactUrl(indexUrl, entry.getUrl())) returns a response where result.isSuccess() is false, so the throw fires before size/digest checks.","commonSituations":"The skill artifact URL in the well-known index is broken or moved (404); the hosting service is down (5xx); the entry URL is relative and resolveArtifactUrl produced a wrong absolute URL; CDN/auth-gated artifact requiring credentials.","solutions":["Inspect the resolved artifact URL in the message and open it in a browser/curl to confirm.","Update the well-known index entry's url field to the correct artifact location.","Retry transient 5xx errors; for persistent 404, report the broken entry to the index maintainer."],"exampleFix":"// before: index entry points to a stale URL\n{\"name\":\"my-skill\",\"url\":\"/old/path/skill.md\"}\n\n// after: corrected artifact URL\n{\"name\":\"my-skill\",\"url\":\"/skills/my-skill/skill.md\"}","handlingStrategy":"retry","validationCode":"// Probe the resolved artifact URL before the full import.\nImportHttpResponse probe = fetchUrl(resolveArtifactUrl(indexUrl, entry.getUrl()));\nif (!probe.isSuccess()) {\n    throw new IllegalStateException(\"Artifact unreachable: HTTP \" + probe.getStatusCode());\n}","typeGuard":null,"tryCatchPattern":"try {\n    return fetchVersion020Artifact(resolvedIndex, entry);\n} catch (IllegalStateException e) {\n    if (e.getMessage().startsWith(\"HTTP 4\")) {\n        // permanent: report broken entry to index maintainer\n    }\n    throw e;\n}","preventionTips":["Validate index entry URLs resolve before publishing the well-known index.","Keep artifact URLs stable; use redirects instead of breaking links.","Cache downloaded artifacts to survive transient upstream failures."],"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"}