{"record":{"id":"a726da9082a89b52","repo":"xai-org/grok-build","slug":"not-a-file","errorCode":null,"errorMessage":"not a file: {}","messagePattern":"not a file: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-grok-shell/src/session/file_system.rs","lineNumber":174,"sourceCode":"pub async fn read_file(abs_path: &Path) -> Result<FsReadFileData> {\n    let bytes = tokio::fs::read(abs_path).await?;\n    Ok(build_file_entry(&bytes))\n}\n\n/// Binary-safe ranged read: returns the chunk `[offset, offset + min(length,\n/// max_bytes, cap))` with the full file `size`. `lineCount` is omitted and\n/// the MIME `type` is a coarse text/binary tag (mid-file chunks defeat\n/// magic-byte sniffing).\npub(crate) async fn read_file_ranged(\n    abs_path: &Path,\n    offset: u64,\n    length: u64,\n    max_bytes: u64,\n    encoding: FsReadEncoding,\n) -> Result<FsReadFileData> {\n    let md = tokio::fs::metadata(abs_path).await?;\n    if md.is_dir() {\n        anyhow::bail!(\"not a file: {}\", abs_path.display());\n    }\n    // Best-effort snapshot: a concurrent truncate/grow between here and\n    // read_range can make `size` inconsistent with the returned chunk.\n    let size = md.len();\n    let length = wfs::clamp_read_length(Some(length), max_bytes);\n    let chunk = wfs::read_range(abs_path, offset, length).await?;\n    let (payload, is_text) = wfs::encode_chunk(chunk, encoding);\n    let (content, content_base64) = match payload {\n        wfs::ChunkPayload::Text(t) => (t, None),\n        wfs::ChunkPayload::Base64(b) => (String::new(), Some(b)),\n    };\n    Ok(FsReadFileData {\n        content,\n        content_base64,\n        size,\n        line_count: None,\n        content_type: if is_text {\n            \"text/plain\".to_string()","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-shell/src/session/file_system.rs#L156-L192","documentation":"Error \"not a file: {}\" thrown in xai-org/grok-build.","triggerScenarios":"Thrown at crates/codegen/xai-grok-shell/src/session/file_system.rs:174 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}