{"record":{"id":"af9f51537b742956","repo":"BloopAI/vibe-kanban","slug":"workspace-has-no-repositories-configured","errorCode":null,"errorMessage":"Workspace has no repositories configured","messagePattern":"Workspace has no repositories configured","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/local-deployment/src/container.rs","lineNumber":167,"sourceCode":"                ContainerError::Other(anyhow!(\"Repository already attached to workspace\"))\n            }\n            WorkspaceError::BranchNotFound { repo_name, branch } => ContainerError::Other(anyhow!(\n                \"Branch '{}' does not exist in repository '{}'\",\n                branch,\n                repo_name\n            )),\n            WorkspaceError::PartialCreation(msg) => ContainerError::Other(anyhow!(msg)),\n        }\n    }\n\n    async fn workspace_repo_inputs(\n        &self,\n        workspace_id: Uuid,\n    ) -> Result<(Vec<Repo>, Vec<RepoWorkspaceInput>), ContainerError> {\n        let workspace_repos =\n            WorkspaceRepo::find_by_workspace_id(&self.db.pool, workspace_id).await?;\n        if workspace_repos.is_empty() {\n            return Err(ContainerError::Other(anyhow!(\n                \"Workspace has no repositories configured\"\n            )));\n        }\n\n        let repositories =\n            WorkspaceRepo::find_repos_for_workspace(&self.db.pool, workspace_id).await?;\n        let target_branches: HashMap<_, _> = workspace_repos\n            .iter()\n            .map(|wr| (wr.repo_id, wr.target_branch.clone()))\n            .collect();\n\n        let workspace_inputs: Vec<RepoWorkspaceInput> = repositories\n            .iter()\n            .map(|repo| {\n                let target_branch = target_branches.get(&repo.id).cloned().ok_or_else(|| {\n                    ContainerError::Other(anyhow!(\n                        \"Missing target branch mapping for repo {} in workspace {}\",\n                        repo.id,","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/BloopAI/vibe-kanban/blob/4deb7eca8f381f7cbc1f9d15515a9ab8f8009053/crates/local-deployment/src/container.rs#L149-L185","documentation":"workspace_repo_inputs loads the workspace's repo mappings and aborts with this error if WorkspaceRepo::find_by_workspace_id returns an empty list. A workspace in this system is defined by its repositories, so any operation that needs repo inputs (create, ensure_container_exists) cannot proceed without at least one. It is a data-consistency guard against workspaces with no configured repos.","triggerScenarios":"Calling create or ensure_container_exists for a workspace_id whose workspace_repos rows are absent — e.g. workspace row created but repos never attached, or repos were removed after creation.","commonSituations":"Creating a workspace request with an empty repos array; manually deleting workspace_repos rows in the DB; a failed PartialCreation cleanup leaving an empty workspace; passing a wrong/old workspace_id.","solutions":["Ensure the create-workspace request includes at least one repository in its repos list.","Verify in the DB that workspace_repos rows exist for the workspace_id (`SELECT * FROM workspace_repos WHERE workspace_id = ...`).","Attach a repo to the workspace before retrying the operation.","If the workspace is genuinely empty/legacy, delete it and create a new one with repos."],"exampleFix":"// before\nlet ws = container.create(&CreateWorkspaceReq { repos: vec![], .. }).await?;\n// after\nif req.repos.is_empty() {\n    return Err(anyhow!(\"At least one repository is required\"));\n}\nlet ws = container.create(&req).await?;","handlingStrategy":"validation","validationCode":"let repos = WorkspaceRepo::find_by_workspace_id(&pool, ws_id).await?;\nif repos.is_empty() {\n    return Err(anyhow!(\"workspace {ws_id} has no repos; attach one first\"));\n}","typeGuard":null,"tryCatchPattern":"match container.create(&req).await {\n    Err(ContainerError::Other(e)) if e.to_string().contains(\"no repositories configured\") => {\n        // prompt user to add repos, don't retry blindly\n        Err(e)\n    }\n    other => other,\n}","preventionTips":["Enforce at least one repo in create-workspace requests (client and server side).","Block deletion of the last workspace repo mapping.","Validate workspace state after PartialCreation cleanup.","Confirm the workspace_id is the intended one before operating on it."],"tags":["workspace","configuration","validation"],"backgroundTag":"missing-required-configuration","analyzedSha":"4deb7eca8f381f7cbc1f9d15515a9ab8f8009053","analyzedAt":"2026-08-29T09:24:13.446Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}