{"record":{"id":"4846db7705cafe37","repo":"theonedev/onedev","slug":"internal-error-4846db","errorCode":null,"errorMessage":"internal error","messagePattern":"internal error","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"server-plugin/server-plugin-pack-pypi/src/main/java/io/onedev/server/plugin/pack/pypi/PypiPackPanel.java","lineNumber":44,"sourceCode":"public class PypiPackPanel extends GenericPanel<Pack> {\n\t\n\tpublic PypiPackPanel(String id, IModel<Pack> model) {\n\t\tsuper(id, model);\n\t}\n\n\t@Override\n\tprotected void onInitialize() {\n\t\tsuper.onInitialize();\n\n\t\tvar serverUrl = getServerUrl();\n\t\tString protocol;\n\t\tString host;\n\t\ttry {\n\t\t\tvar url = new URL(serverUrl);\n\t\t\t protocol = url.getProtocol();\n\t\t\t host = url.getHost();\n\t\t} catch (MalformedURLException e) {\n\t\t\tthrow new RuntimeException(e);\n\t\t}\n\t\tvar canAccessAnonymously = SecurityUtils.asAnonymous().isPermitted(\n\t\t\t\tnew ProjectPermission(getPack().getProject(), new ReadPack()));\n\t\tvar authPart = canAccessAnonymously ? \"\" : \"<OneDev_account_name>:<OneDev_password>@\";\n\t\tvar indexUrl = protocol + \"://\" + authPart + UrlUtils.getServer(serverUrl) \n\t\t\t\t+ \"/\" + getPack().getProject().getPath() + \"/~\" + PypiPackHandler.HANDLER_ID + \"/simple/\";\n\t\tadd(new WebMarkupContainer(\"readPermissionNote\").setVisible(!canAccessAnonymously));\n\t\tvar installCmd = \"$ python3 -m pip install --extra-index-url \" + indexUrl;\n\t\tif (protocol.equals(\"http\"))\n\t\t\tinstallCmd += \" --trusted-host \" + host;\n\t\tinstallCmd += \" \" + getPack().getName() + \"==\" + getPack().getVersion();\n\t\tadd(new Label(\"install\", installCmd));\n\n\t\tindexUrl = protocol + \"://@job_token@:@secret:access-token@@@\" + UrlUtils.getServer(serverUrl)\n\t\t\t\t+ \"/\" + getPack().getProject().getPath() + \"/~\" + PypiPackHandler.HANDLER_ID + \"/simple/\";\n\t\tvar jobCommands = \"\" +\n\t\t\t\t\"# \" + _T(\"Use job token to tell OneDev the build using the package\") + \"\\n\" +\n\t\t\t\t\"# \" + _T(\"Job secret 'access-token' should be defined in project build setting as an access token with package read permission\") + \"\\n\\n\" +","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-plugin/server-plugin-pack-pypi/src/main/java/io/onedev/server/plugin/pack/pypi/PypiPackPanel.java#L26-L62","documentation":"PypiPackPanel.onInitialize parses the configured server URL with new URL(...) and wraps MalformedURLException in a RuntimeException. It means the OneDev server URL configured for display of pip usage instructions is malformed (no protocol, bad syntax).","triggerScenarios":"The server URL in OneDev system settings (or the value passed to the panel) is empty, missing scheme, or otherwise not a valid absolute URL when the PyPI package page is rendered.","commonSituations":"Admin set server url to 'localhost:8080' without http(s):// in admin settings; placeholder not replaced; trailing typo in the URL after a server migration.","solutions":["Fix the server URL in Administration > System Setting so it is a full absolute URL like https://onedev.example.com","Include the http:// or https:// scheme explicitly","Reload the package page to confirm instructions render"],"exampleFix":"// before\nString serverUrl = \"localhost:8080\";\n// after\nString serverUrl = \"https://localhost:8080\";","handlingStrategy":"validation","validationCode":"function validateServerUrl(url) {\n  try { new java.net.URL(url); return true; } catch (e) { return false; }\n}\n// only proceed when validateServerUrl(serverUrl) is true and starts with http(s)://","typeGuard":"function isValidUrl(u) { try { const p = new URL(u); return p.protocol === 'http:' || p.protocol === 'https:'; } catch { return false; } }","tryCatchPattern":"try { renderPanel(); } catch (RuntimeException e) { if (e.getCause() instanceof MalformedURLException) showConfigWarning('Fix server URL in system settings'); else throw e; }","preventionTips":["Always configure the OneDev server URL as a full absolute URL with scheme in admin settings","Validate the URL after server setup and after migrations","Avoid hand-editing server URL values with missing protocols"],"tags":["configuration","url"],"backgroundTag":"invalid-url-format","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}