{"record":{"id":"49c944ce7649ded4","repo":"theonedev/onedev","slug":"path-mountpath-should-be-mounted-to-a-svg-spr","errorCode":null,"errorMessage":"Path '${mountPath}' should be mounted to a svg sprite resource reference","messagePattern":"Path '(.+?)' should be mounted to a svg sprite resource reference","errorType":"exception","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/web/component/svg/SpriteImage.java","lineNumber":92,"sourceCode":"\t\tString href = getDefaultModelObjectAsString();\n\t\tClass<?> scope;\n\t\tString symbol;\n\t\tint index = href.indexOf('#');\n\t\tif (index != -1) {\n\t\t\tsymbol = StringUtils.strip(href.substring(index+1), \"/\");\n\t\t\tString mountPath = StringUtils.strip(href.substring(0, index), \"/\").trim();\n\t\t\tif (mountPath.length() != 0) {\n\t\t\t\tscope = spriteScopes.get(mountPath);\n\t\t\t\tif (scope == null) {\n\t\t\t\t\tList<BaseResourceMapper> resourceMappers = new ArrayList<>();\n\t\t\t\t\tlistResourceMappers(getApplication().getRootRequestMapper(), resourceMappers);\n\t\t\t\t\tfor (BaseResourceMapper mapper: resourceMappers) {\n\t\t\t\t\t\tBaseResourceMapper baseMapper = (BaseResourceMapper) mapper;\n\t\t\t\t\t\tif (StringUtils.strip(baseMapper.getPath(), \"/\").equalsIgnoreCase(mountPath)) {\n\t\t\t\t\t\t\tif (baseMapper.getResourceReference() instanceof SpriteResourceReference) {\n\t\t\t\t\t\t\t\tscope = baseMapper.getResourceReference().getScope();\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthrow new ExplicitException(\"Path '\" + mountPath \n\t\t\t\t\t\t\t\t\t\t+ \"' should be mounted to a svg sprite resource reference\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (scope == null)\n\t\t\t\t\t\tthrow new ExplicitException(\"Unable to find svg sprite resource mounted at: \" + mountPath);\n\t\t\t\t\t\n\t\t\t\t\tspriteScopes.put(mountPath, scope);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tscope = IconScope.class;\n\t\t\t}\n\t\t} else {\n\t\t\tscope = IconScope.class;\n\t\t\tsymbol = StringUtils.strip(href, \"/\");\n\t\t}\n\t\t","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/web/component/svg/SpriteImage.java#L74-L110","documentation":"SpriteImage resolves the SVG sprite reference by looking up the resource mapper mounted at the configured mountPath and requires it to be a SpriteResourceReference (an SVG sprite resource). If the path is mounted but points to another resource type it throws an ExplicitException; a non-mounted path yields a different path (scope == null) failure. This enforces that the resource actually contains an SVG sprite symbol registry.","triggerScenarios":"Pointing SpriteImage's mount path (e.g. via SpriteImage.mountPath setting) at a resource mapper that is not an SVG sprite resource — e.g. a plain CSS/JS/image resource mounted at the same path.","commonSituations":"Configuration mistake where the sprite mount path points to a generic resource reference; refactoring resource registration so the sprite resource is no longer registered as SpriteResourceReference; copy-pasting another resource's mount path.","solutions":["Register the SVG sprite resource as a SpriteResourceReference and mount it at the configured path.","Update the SpriteImage mount path configuration to point at the actual sprite resource mount.","Verify with the resourceMappers list that the path's mapper resource reference is of type SpriteResourceReference.","After changing resource registration, restart/rebuild so hot-loaded classes pick up the mapper."],"exampleFix":"// before\nmountResource(\"/img/icons.svg\", new PackageResourceReference(App.class, \"icons.svg\"));\n// after\nmountResource(\"/img/icons.svg\", new SpriteResourceReference(App.class, \"icons.svg\"));","handlingStrategy":"validation","validationCode":"boolean isSprite = Application.get().getResourceReferenceRegistry()\n  .listResourceMappers().stream()\n  .anyMatch(m -> ((BaseResourceMapper) m).getResourceReference() instanceof SpriteResourceReference\n     && path.equals(((BaseResourceMapper) m).getPath()));","typeGuard":"boolean isSpriteMount(BaseResourceMapper m) { return m.getResourceReference() instanceof SpriteResourceReference; }","tryCatchPattern":"try { add(spriteImage); } catch (ExplicitException e) { if (e.getMessage().contains(\"svg sprite\")) { fixMountPath(); } else { throw e; } }","preventionTips":["Keep a single constant for the sprite mount path shared by registration and SpriteImage config","Always mount sprite resources via SpriteResourceReference","Verify resource mapper registrations after refactors"],"tags":["wicket","svg","resource-mounting","configuration"],"backgroundTag":"invalid-config-value","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}