{"record":{"id":"0a8e836a884e50a3","repo":"NationalSecurityAgency/ghidra","slug":"data-directory-does-not-exist","errorCode":null,"errorMessage":"Data directory {} does not exist","messagePattern":"Data directory (.+?) does not exist","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimControlLaunchable.java","lineNumber":952,"sourceCode":"\t\t\tnew File(dataDirectory, \"server.key\"));\n\t}\n\n\t/**\n\t * Scan the PostgreSQL data directory from the command-line\n\t * Make sure the directory exists and establish the File object -dataDirectory-\n\t * @param params are the command-line arguments\n\t * @param slot is the position to retrieve the data directory argument\n\t * @throws IllegalArgumentException if the data directory is invalid\n\t * @throws IOException if the canonical file cannot be retrieved\n\t */\n\tprivate void scanDataDirectory(String[] params, int slot)\n\t\t\tthrows IllegalArgumentException, IOException {\n\t\tif (params.length <= slot) {\n\t\t\tthrow new IllegalArgumentException(\"Missing data directory\");\n\t\t}\n\t\tdataDirectory = new File(params[slot]);\n\t\tif (!dataDirectory.isDirectory()) {\n\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\"Data directory \" + dataDirectory.getAbsolutePath() + \" does not exist\");\n\t\t}\n\t\tdataDirectory = dataDirectory.getCanonicalFile();\n\t}\n\n\t/**\n\t * Scan the username from the command-line\n\t * @param params are the command-line arguments\n\t * @param slot is the position to retrieve the username argument\n\t * @throws IllegalArgumentException if the user name is not in the given params\n\t */\n\tprivate void scanUsername(String[] params, int slot) throws IllegalArgumentException {\n\t\tif (params.length <= slot) {\n\t\t\tthrow new IllegalArgumentException(\"Missing username\");\n\t\t}\n\t\tspecifiedUserName = params[slot];\n\t}\n","sourceCodeStart":934,"sourceCodeEnd":970,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimControlLaunchable.java#L934-L970","documentation":"Thrown by scanDataDirectory() when the provided path exists but File.isDirectory() is false — the path is missing, is a regular file, or is a broken symlink. BSim treats the data directory as the PostgreSQL cluster root and requires it to be a real directory.","triggerScenarios":"Passing a non-existent or file path as the data directory: `bsim_ctl start /path/that/does/not/exist` or pointing at a file.","commonSituations":"Typo in the directory path; relative path resolved from the wrong cwd; directory not yet created; path points at a file (e.g. postgresql.conf) instead of the cluster root.","solutions":["Create the directory first: `mkdir -p <dataDir>`.","Use an absolute path to avoid cwd ambiguity.","Point at the cluster root (the dir containing postgresql.conf), not a file inside it.","Verify with `ls -ld <dataDir>` that it is a directory."],"exampleFix":"// before\nbsim_ctl start /var/bsim/missing\n// after\nmkdir -p /var/bsim/data && bsim_ctl start /var/bsim/data","handlingStrategy":"validation","validationCode":"File d = new File(dataDirPath);\nif (!d.isDirectory()) {\n    throw new IllegalArgumentException(\n        \"Data directory does not exist or is not a directory: \" + d.getAbsolutePath());\n}","typeGuard":"public boolean isExistingDataDir(File d) {\n    return d != null && d.isDirectory();\n}","tryCatchPattern":"try {\n    bsimControl.exec(args);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Data directory\")\n        && e.getMessage().endsWith(\"does not exist\")) {\n        throw new UserFacingException(\"Create the data dir first: mkdir -p \" + dataDirPath, e);\n    }\n    throw e;\n}","preventionTips":["Pre-create the data directory in provisioning scripts.","Use absolute paths to avoid cwd-relative surprises.","Point at the cluster root, not a file inside it."],"tags":["cli","arguments","file-system","bsim"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}