{"record":{"id":"cbde8228e6893bab","repo":"theonedev/onedev","slug":"unable-to-find-youtrack-project","errorCode":null,"errorMessage":"Unable to find YouTrack project: ","messagePattern":"Unable to find YouTrack project: ","errorType":"exception","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-plugin/server-plugin-import-youtrack/src/main/java/io/onedev/server/plugin/imports/youtrack/ImportServer.java","lineNumber":222,"sourceCode":"\tImportOption buildImportOption(String project, boolean populateTagMappings) {\n\t\tClient client = newClient();\n\t\ttry {\n\t\t\tString apiEndpoint = getApiEndpoint(\"/admin/projects?fields=id,name,customFields(field(name),bundle(values(name)))\");\n\t\t\tfor (JsonNode projectNode : list(client, apiEndpoint, new TaskLogger() {\n\n\t\t\t\t@Override\n\t\t\t\tpublic void log(String message, String sessionId) {\n\t\t\t\t\tlogger.info(message);\n\t\t\t\t}\n\n\t\t\t})) {\n\t\t\t\tif (project.equals(projectNode.get(\"name\").asText())) {\n\t\t\t\t\tList<JsonNode> projectNodes = new ArrayList<>();\n\t\t\t\t\tprojectNodes.add(projectNode);\n\t\t\t\t\treturn buildImportOption(projectNodes, populateTagMappings);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthrow new ExplicitException(\"Unable to find YouTrack project: \" + project);\n\t\t} finally {\n\t\t\tclient.close();\n\t\t}\n\t}\n\n\tImportOption buildImportOption(Collection<JsonNode> projectNodes, boolean populateTagMappings) {\n\t\tImportOption option = new ImportOption();\n\t\tClient client = newClient();\n\t\ttry {\n\t\t\tSet<String> youTrackIssueStates = new LinkedHashSet<>();\n\t\t\tSet<String> youTrackIssueFields = new LinkedHashSet<>();\n\n\t\t\tfor (JsonNode projectNode : projectNodes) {\n\t\t\t\tfor (JsonNode customFieldNode : projectNode.get(\"customFields\")) {\n\t\t\t\t\tString fieldName = customFieldNode.get(\"field\").get(\"name\").asText();\n\t\t\t\t\tJsonNode bundleNode = customFieldNode.get(\"bundle\");\n\t\t\t\t\tif (bundleNode != null) {\n\t\t\t\t\t\tString bundleType = bundleNode.get(\"$type\").asText();","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-plugin/server-plugin-import-youtrack/src/main/java/io/onedev/server/plugin/imports/youtrack/ImportServer.java#L204-L240","documentation":"Thrown by the YouTrack importer when the YouTrack project name specified in the import settings cannot be found among the projects returned by the YouTrack API. buildImportOption iterates fetched project nodes; if none matches the requested name, it aborts with this ExplicitException.","triggerScenarios":"Calling newSetting or buildImportOption with a project name that does not exactly match any YouTrack project name returned by the API — the project was renamed/deleted in YouTrack, the token cannot see it, or the name differs in case/whitespace.","commonSituations":"YouTrack project renamed after import settings were saved; using an archived project name; API token scoped to a subset of projects; typo when editing settings YAML.","solutions":["Re-generate the import settings so the project list is refreshed from YouTrack and re-pick the project.","Verify the exact project name in YouTrack (check case and trailing spaces).","Ensure the YouTrack token's permissions include visibility of that project.","Restore/unarchive the project in YouTrack if it was archived."],"exampleFix":"// before\nyouTrackProject: \"Old App\"\n\n// after: exact current YouTrack project name\nyouTrackProject: \"Old App (Archived)\"","handlingStrategy":"validation","validationCode":"// confirm the YouTrack project exists before importing\nList<JsonNode> projects = listYouTrackProjects(client);\nboolean found = projects.stream()\n    .anyMatch(p -> p.get(\"name\").asText().equals(youTrackProjectName));\nif (!found) throw new IllegalArgumentException(\"YouTrack project not found: \" + youTrackProjectName);","typeGuard":null,"tryCatchPattern":"try { option = importServer.newSetting(...); } catch (ExplicitException e) { logger.warn(\"YouTrack project lookup failed: {}\", e.getMessage()); }","preventionTips":["Pick the project from the generated list rather than typing the name.","Re-generate settings after any YouTrack project rename.","Ensure the token can see all intended projects."],"tags":["youtrack","import","project-not-found","configuration"],"backgroundTag":"resource-not-found","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"}