{"record":{"id":"29e59956406eaad6","repo":"NationalSecurityAgency/ghidra","slug":"unsupported-repository-url-ghidraurl","errorCode":null,"errorMessage":"Unsupported repository URL: {ghidraURL}","messagePattern":"Unsupported repository URL: (.+?)","errorType":"validation","errorClass":"MalformedURLException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/IterateRepository.java","lineNumber":57,"sourceCode":"\t * @throws IOException if an error occured during processing.\n\t * @throws CancelledException if processing was cancelled\n\t */\n\tprotected abstract void process(Program program, TaskMonitor monitor)\n\t\t\tthrows IOException, CancelledException;\n\n\t/**\n\t * Process the specified repository URL\n\t * @param ghidraURL ghidra URL for existing server repository and optional\n\t * folder path\n\t * @param monitor task monitor\n\t * @throws Exception if an error occurs during processing\n\t * @throws CancelledException if processing is cancelled\n\t */\n\tpublic void process(URL ghidraURL, TaskMonitor monitor) throws Exception, CancelledException {\n\n\t\tif (!GhidraURL.isServerRepositoryURL(ghidraURL) &&\n\t\t\t!GhidraURL.isLocalURL(ghidraURL)) {\n\t\t\tthrow new MalformedURLException(\"Unsupported repository URL: \" + ghidraURL);\n\t\t}\n\n\t\t// Query URL - may be either file or folder (no link following)\n\t\tGhidraURLQuery.queryUrl(ghidraURL, null, new GhidraURLResultHandlerAdapter(true) {\n\n\t\t\t@Override\n\t\t\tpublic void processResult(DomainFolder domainFolder, URL url, TaskMonitor m)\n\t\t\t\t\tthrows IOException, CancelledException {\n\n\t\t\t\tint totalFiles = getTotalFileCount(domainFolder);\n\n\t\t\t\tmonitor.setMaximum(totalFiles);\n\t\t\t\tmonitor.setShowProgressValue(true);\n\n\t\t\t\tprocess(domainFolder, monitor);\n\t\t\t}\n\n\t\t\t@Override","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/IterateRepository.java#L39-L75","documentation":"Thrown by IterateRepository.process when the provided URL is neither a server repository URL (GhidraURL.isServerRepositoryURL returns false) nor a local URL (GhidraURL.isLocalURL returns false). IterateRepository only supports Ghidra server repository URLs (ghidra:// or https://) and local file URLs. Any other scheme or malformed URL is rejected.","triggerScenarios":"Passing a URL with an unsupported scheme (e.g., http://, ftp://), a plain filesystem path that is not wrapped as a Ghidra local URL, a malformed URL string, or a URL pointing to a non-repository resource. GhidraURL requires specific formats: 'ghidra://host/repo/folder' for server repos or local project paths formatted as Ghidra local URLs.","commonSituations":"Passing a raw filesystem path instead of converting it to a GhidraURL first; typo in the URL scheme; pointing at a web URL instead of a Ghidra repository server; using a URL format from a different Ghidra version; the URL was constructed without GhidraURL.toURL helpers.","solutions":["For local projects, use GhidraURL.toLocalURL(domainFolder) or GhidraURL.getLocalURL(project, path) to construct a valid local URL.","For server repositories, use GhidraURL.toServerRepositoryURL(host, port, repoName) or the equivalent.","Verify the URL scheme: server repos use 'ghidra://' or 'https://', local URLs use 'file://' with Ghidra project structure.","Print the URL before passing it to process() to verify the format."],"exampleFix":"// before\nif (!GhidraURL.isServerRepositoryURL(ghidraURL) && !GhidraURL.isLocalURL(ghidraURL)) {\n    throw new MalformedURLException(\"Unsupported repository URL: \" + ghidraURL);\n}\n\n// caller fix — construct a proper URL\n// before (wrong):\n//   URL url = new URL(\"file:/path/to/project/folder\");\n//   iter.process(url, monitor);\n\n// after (correct):\n//   URL url = GhidraURL.toLocalURL(domainFolder);\n//   iter.process(url, monitor);","handlingStrategy":"validation","validationCode":"// Validate the URL type before calling process\nif (ghidraURL == null) {\n    throw new IllegalArgumentException(\"ghidraURL must not be null\");\n}\nif (!GhidraURL.isServerRepositoryURL(ghidraURL) && !GhidraURL.isLocalURL(ghidraURL)) {\n    throw new IllegalArgumentException(\n        \"URL must be a Ghidra server repository URL or local URL: \" + ghidraURL +\n        \". Use GhidraURL.toServerRepositoryURL() or GhidraURL.toLocalURL() to construct.\");\n}","typeGuard":"public static boolean isProcessableRepositoryURL(URL url) {\n    return url != null &&\n        (GhidraURL.isServerRepositoryURL(url) || GhidraURL.isLocalURL(url));\n}","tryCatchPattern":"// Validation-based — check URL format before calling process\nif (!isProcessableRepositoryURL(ghidraURL)) {\n    // Try converting a filesystem path to a local URL\n    // Or report the error with guidance\n    throw new IllegalArgumentException(\n        \"Unsupported URL format. Expected ghidra:// or local Ghidra project URL.\");\n}\nrepo.process(ghidraURL, monitor);","preventionTips":["Always construct repository URLs using GhidraURL helper methods (toLocalURL, toServerRepositoryURL).","Never pass raw filesystem paths or non-Ghidra URL schemes to IterateRepository.process.","Validate the URL format before calling process to fail fast with a clear message.","Print the URL before processing to debug format issues."],"tags":["bsim","url-validation","repository","ghidra-url"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}