{"record":{"id":"5dc160233cf3ecca","repo":"warpdotdev/warp","slug":"no-session-provided-to-file-glob","errorCode":null,"errorMessage":"No session provided to file_glob","messagePattern":"No session provided to file_glob","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/src/ai/blocklist/action_model/execute/file_glob.rs","lineNumber":209,"sourceCode":"            .is_some_and(|session| session.supports_parallel_command_execution())\n    }\n}\n\nfn is_file_glob_v2(input: &ExecuteActionInput) -> bool {\n    matches!(input.action.action, AIAgentActionType::FileGlobV2 { .. })\n}\n\nasync fn run_file_glob(\n    patterns: Vec<String>,\n    absolute_path: String,\n    session: Option<Arc<Session>>,\n    shell_launch_data: Option<ShellLaunchData>,\n) -> anyhow::Result<FileGlobV2Result> {\n    if patterns.is_empty() {\n        return Err(anyhow::anyhow!(\"No patterns provided to file_glob\"));\n    }\n    let Some(session) = session else {\n        return Err(anyhow::anyhow!(\"No session provided to file_glob\"));\n    };\n    let shell_type = session.shell().shell_type();\n\n    let is_in_git_repo = is_git_repository(&absolute_path, session.as_ref())\n        .await\n        .unwrap_or_else(|e| {\n            report_error!(e.context(\"Failed to run command to check if in git repository\"));\n            false\n        });\n\n    if is_in_git_repo {\n        run_git_ls_files_command(\n            &patterns,\n            &absolute_path,\n            session.as_ref(),\n            shell_launch_data,\n            shell_type,\n        )","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/warpdotdev/warp/blob/e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc/app/src/ai/blocklist/action_model/execute/file_glob.rs#L191-L227","documentation":"run_file_glob requires an active terminal Session (used for shell type selection and git checks). When the executor's active_session resolves to None, the invocation fails immediately with this message.","triggerScenarios":"Executing a file_glob action in a context where executor.active_session is absent - e.g. an ambient/headless run with no attached terminal session (file_glob.rs:215-218).","commonSituations":"Agent actions dispatched from background (cloud/ambient) execution where no local terminal exists; session torn down between action queueing and execution; wiring bug leaving active_session unset.","solutions":["Ensure file_glob is only dispatched from executors with a live active_session","For headless flows, provide a detached Session or route globbing through a sessionless implementation","Check whether the session was closed mid-run and re-dispatch after rebinding"],"exampleFix":"// before\nlet session = self.active_session.as_ref(ctx).session(ctx); // Option<Arc<Session>>\n\n// after\nlet Some(session) = self.active_session.as_ref(ctx).session(ctx) else {\n    return Err(anyhow!(\"file_glob requires an active session\"));\n};","handlingStrategy":"validation","validationCode":"let Some(session) = self.active_session.as_ref(ctx).session(ctx) else {\n    return Err(anyhow!(\"file_glob requires an active session\"));\n};","typeGuard":"fn has_session(executor: &FileGlobExecutor, ctx: &AppContext) -> bool {\n    executor.active_session.as_ref(ctx).session(ctx).is_some()\n}","tryCatchPattern":"match run_file_glob(patterns, path, session, shell).await {\n    Err(e) if e.to_string() == \"No session provided to file_glob\" => {\n        rebind_session_and_redispatch().await\n    }\n    r => r,\n}","preventionTips":["Only dispatch file_glob from contexts that own a live terminal session","Bind the session at action-creation time and fail fast if absent","Give headless/ambient flows a sessionless glob implementation instead of relying on active_session"],"tags":["rust","warp","file-glob","session","validation"],"backgroundTag":null,"analyzedSha":"e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc","analyzedAt":"2026-08-16T08:27:25.381Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}