{"record":{"id":"21d14ef489057d5d","repo":"theonedev/onedev","slug":"invalid-pack-id-0","errorCode":null,"errorMessage":"Invalid pack ID: {0}","messagePattern":"Invalid pack ID: (.+?)","errorType":"validation","errorClass":"NotAcceptableException","httpStatus":406,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/web/page/project/packs/detail/PackDetailPage.java","lineNumber":66,"sourceCode":"\t\n\tprotected final IModel<Pack> packModel;\n\t\n\tpublic PackDetailPage(PageParameters params) {\n\t\tsuper(params);\n\t\t\n\t\tString packIdString = params.get(PARAM_PACK).toString();\n\t\tif (StringUtils.isBlank(packIdString))\n\t\t\tthrow new RestartResponseException(ProjectPacksPage.class, ProjectPacksPage.paramsOf(getProject(), null, 0));\n\t\t\t\n\t\tpackModel = new LoadableDetachableModel<>() {\n\n\t\t\t@Override\n\t\t\tprotected Pack load() {\n\t\t\t\tLong packId;\n\t\t\t\ttry {\n\t\t\t\t\tpackId = Long.valueOf(packIdString);\n\t\t\t\t} catch (NumberFormatException e) {\n\t\t\t\t\tthrow new NotAcceptableException(MessageFormat.format(_T(\"Invalid pack ID: {0}\"), packIdString));\n\t\t\t\t}\n\t\t\t\treturn OneDev.getInstance(PackService.class).load(packId);\n\t\t\t}\n\n\t\t};\n\t}\n\t\n\tpublic Pack getPack() {\n\t\treturn packModel.getObject();\n\t}\n\t\n\t@Override\n\tprotected boolean isPermitted() {\n\t\treturn SecurityUtils.canReadPack(getProject());\n\t}\n\t\n\t@Override\n\tprotected BookmarkablePageLink<Void> navToProject(String componentId, Project project) {","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/web/page/project/packs/detail/PackDetailPage.java#L48-L84","documentation":"PackDetailPage parses the pack ID from page parameters; a non-numeric ID throws NotAcceptableException with this message. It validates format only — a valid Long that doesn't correspond to a pack will instead fail later in PackService.load.","triggerScenarios":"Visiting a pack detail URL where the ID segment is not a number, e.g. /~packs/xyz; malformed or hand-edited URLs; code interpolating a package name instead of its numeric ID.","commonSituations":"Copying only part of a pack URL; scripts using a human-readable package name where the numeric pack ID is required; stale link templates after URL scheme changes.","solutions":["Use the numeric pack ID in the pack detail URL.","Obtain the ID from the pack object (pack.getId()) when generating links.","Fix truncated or corrupted URL segments."],"exampleFix":"// before\nString url = \"/~packs/\" + packName;\n// after\nString url = \"/~packs/\" + pack.getId();","handlingStrategy":"validation","validationCode":"if (!packIdString.matches(\"\\\\d+\")) throw new IllegalArgumentException(\"Pack ID must be numeric: \" + packIdString);\nLong packId = Long.valueOf(packIdString);","typeGuard":"Long parsePackId(String s) { try { return Long.valueOf(s); } catch (NumberFormatException e) { return null; } }","tryCatchPattern":"try { pack = packService.load(packId); } catch (NumberFormatException e) { log.error(\"Malformed pack id\"); }","preventionTips":["Build pack URLs from pack.getId(), not names or hand-written strings.","Keep numeric IDs intact when copying/sharing URLs.","Avoid manual URL edits for pack pages."],"tags":["wicket","packs","url-parameter","number-format"],"backgroundTag":"invalid-argument-format","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"}