{"record":{"id":"ebeaa19719768d33","repo":"theonedev/onedev","slug":"spec-not-found-in-workspace-project-hierarchy","errorCode":null,"errorMessage":"Spec not found in workspace project hierarchy","messagePattern":"Spec not found in workspace project hierarchy","errorType":"exception","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/workspace/DefaultWorkspaceService.java","lineNumber":778,"sourceCode":"\t\t\tif (spec.isRunInContainer()) {\n\t\t\t\tthrow new ExplicitException(\"\"\"\n\t\t\t\t\tNo applicable provisioner discovered for current workspace. \\\n\t\t\t\t\tPlease check if docker is installed on OneDev server, or configure \\\n\t\t\t\t\ta kubernetes provisioner if you would like workspaces to run as pods\"\"\");\n\t\t\t} else {\n\t\t\t\tthrow new ExplicitException(\"\"\"\n\t\t\t\t\tNo applicable provisioner discovered for current workspace. \\\n\t\t\t\t\tPlease add a shell provisioner in menu 'Administration / Workspace Provisioners'\"\"\");\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate Future<Void> run(Workspace workspace) {\n\t\tWorkspace.push(workspace);\n\t\ttry {\n\t\t\tvar spec = workspace.getSpec();\n\t\t\tif (spec == null)\n\t\t\t\tthrow new ExplicitException(\"Spec not found in workspace project hierarchy\");\n\n\t\t\tvar interpolator = new WorkspaceVariableInterpolator(workspace);\n\t\t\tspec = interpolator.interpolateProperties(spec);\n\n\t\t\tString token = workspace.getToken();\n\t\t\tvar project = workspace.getProject();\n\t\t\tvar projectId = project.getId();\n\t\t\tvar projectPath = project.getPath();\n\t\t\tvar projectGitDir = projectService.getGitDir(project.getId()).getAbsolutePath();\n\t\t\tvar workspaceId = workspace.getId();\n\t\t\tvar workspaceNumber = workspace.getNumber();\n\n\t\t\tvar workspaceLogger = logService.newLogger(workspace.getLoggingSupport());\n\t\t\tvar provisioner = getProvisioner(workspace, spec, workspaceLogger);\n\n\t\t\tvar gitEmail = workspace.getUser().getGitEmailAddress();\n\t\t\t\n\t\t\tString cloneUrl;","sourceCodeStart":760,"sourceCodeEnd":796,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/workspace/DefaultWorkspaceService.java#L760-L796","documentation":"Thrown by DefaultWorkspaceService.run() when a workspace's rendered spec is null. OneDev resolves a workspace's CI/CD spec by walking up the project hierarchy (project, then parents) to find the closest spec defining a workspace; if no project in the chain provides one, execution cannot proceed. It is an ExplicitException, so it is surfaced verbatim to the user as an expected, explainable failure.","triggerScenarios":"A job/step requires running a workspace (Workspace.push(workspace) then spec execution), but neither the workspace's own project nor any ancestor project has a workspace spec (.onedev-workspace.yml or spec property) attached.","commonSituations":"Kicking off a job that expects a workspace while the repository has no .onedev-workspace.yml; the spec lives only in a sibling branch or was deleted/renamed; spec resolution disabled on the project so hierarchy lookup returns nothing; typo in spec file location.","solutions":["Add a workspace spec (.onedev-workspace.yml) to the project (or an ancestor project) that owns the workspace.","Commit the spec file to the branch/ref the job runs against.","Fix the project hierarchy so a parent project actually defines the workspace spec.","Verify the job's project is the intended one — the spec may exist in another repository."],"exampleFix":"// before: job runs in project with no workspace spec -> exception\n// after: add .onedev-workspace.yml at repo root\ntype: command\ntasks:\n- name: setup\n  commands: |\n    ./setup-dev-env.sh","handlingStrategy":"validation","validationCode":"// Java\nif (workspace.getSpec() == null)\n    throw new ExplicitException(\"Project hierarchy has no workspace spec; add .onedev-workspace.yml\");","typeGuard":null,"tryCatchPattern":"try { runWorkspace(workspace); } catch (ExplicitException e) { log.error(\"No workspace spec: {}\", e.getMessage()); }","preventionTips":["Commit .onedev-workspace.yml to every branch jobs run against","Define the spec in a parent project so all children inherit it","Validate spec presence in job pre-flight checks"],"tags":["onedev","workspace","missing-spec","ci-cd"],"backgroundTag":"missing-required-config","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"}