{"record":{"id":"0a504c4673ead6a1","repo":"warpdotdev/warp","slug":"no-patterns-provided-to-file-glob","errorCode":null,"errorMessage":"No patterns provided to file_glob","messagePattern":"No patterns provided to file_glob","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/src/ai/blocklist/action_model/execute/file_glob.rs","lineNumber":206,"sourceCode":"        self.active_session\n            .as_ref(ctx)\n            .session(ctx)\n            .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(),","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/warpdotdev/warp/blob/e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc/app/src/ai/blocklist/action_model/execute/file_glob.rs#L188-L224","documentation":"run_file_glob rejects an empty patterns vector up front: file_glob (v1 or v2) with zero patterns is treated as a malformed invocation rather than matching everything.","triggerScenarios":"The agent model emits a FileGlob action whose patterns list is empty, or a caller filters/validates patterns into nothing before invoking run_file_glob (file_glob.rs:212-214).","commonSituations":"Model outputs an empty array for patterns; upstream validation strips invalid entries leaving none; deserialization of the action payload defaults to an empty vec.","solutions":["Validate patterns non-empty before dispatching the action and reject with a descriptive tool error","If the model intended 'everything', translate empty patterns into an explicit '**/*' at the tool boundary","Log the raw action payload when this fires to catch schema/deserialization bugs"],"exampleFix":"// before\nActionExecution::new_async(async move {\n    run_file_glob(patterns_clone, absolute_path, session, shell_launch_data).await\n});\n\n// after\nif patterns.is_empty() {\n    return Err(anyhow!(\"file_glob requires at least one pattern\"));\n}\nActionExecution::new_async(async move {\n    run_file_glob(patterns_clone, absolute_path, session, shell_launch_data).await\n});","handlingStrategy":"validation","validationCode":"if patterns.is_empty() {\n    return Err(anyhow!(\"file_glob requires at least one pattern\"));\n}","typeGuard":"fn valid_glob_request(patterns: &[String]) -> bool {\n    !patterns.is_empty()\n}","tryCatchPattern":"match run_file_glob(patterns, path, session, shell).await {\n    Err(e) if e.to_string() == \"No patterns provided to file_glob\" => {\n        Err(anyhow!(\"model emitted an empty pattern list; re-prompt\"))\n    }\n    r => r,\n}","preventionTips":["Validate the action payload schema (minItems on patterns) at deserialization","Return a descriptive tool error to the model so it re-issues the call with patterns","Decide explicitly whether empty patterns mean 'reject' or '**/*' and enforce it at one boundary"],"tags":["rust","warp","validation","file-glob","agent-actions"],"backgroundTag":null,"analyzedSha":"e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc","analyzedAt":"2026-08-16T08:27:25.381Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}