{"record":{"id":"8d2cf5cef587c607","repo":"hatoo/oha","slug":"failed-to-read-file","errorCode":null,"errorMessage":"Failed to read file '{}': {}","messagePattern":"Failed to read file '(.+?)': (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/curl_compat.rs","lineNumber":121,"sourceCode":"            .ok_or_else(|| anyhow::anyhow!(\"Invalid form format: missing '=' in '{}'\", s))?;\n\n        let name = name.to_string();\n\n        // Parse the value part which may contain semicolon-separated options\n        let parts: Vec<&str> = rest.split(';').collect();\n        let value_part = parts[0];\n\n        let mut filename = None;\n        let mut content_type = None;\n        let data;\n\n        // Check if this is a file upload (@filename or <filename)\n        if let Some(file_path) = value_part.strip_prefix('@') {\n            // Remove '@' prefix\n\n            // Read file content\n            data = std::fs::read(file_path)\n                .map_err(|e| anyhow::anyhow!(\"Failed to read file '{}': {}\", file_path, e))?;\n\n            // Extract filename from path\n            filename = std::path::Path::new(file_path)\n                .file_name()\n                .and_then(|name| name.to_str())\n                .map(|s| s.to_string());\n        } else if let Some(file_path) = value_part.strip_prefix('<') {\n            // Remove '<' prefix\n\n            // Read file content\n            data = std::fs::read(file_path)\n                .map_err(|e| anyhow::anyhow!(\"Failed to read file '{}': {}\", file_path, e))?;\n\n            // Do not set filename for '<' format (curl behavior)\n        } else {\n            // Regular form field with string value\n            data = value_part.as_bytes().to_vec();\n        }","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/hatoo/oha/blob/4efba2d113d165aaaf7533f5d2893e7cc57ebfc1/src/curl_compat.rs#L103-L139","documentation":"I/O failure raised by FormPart::from_str when the -F value uses the '@filename' or '<filename' file-upload form but the file cannot be opened and read (file does not exist, insufficient permissions, or it is a directory). The '{}' placeholders carry the path and the underlying io::Error.","triggerScenarios":"Thrown at src/curl_compat.rs:121 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the path is correct and the file exists (ls / realpath).","Check read permissions on the file and on every directory in its path.","Ensure the target is a regular file, not a directory or special device.","If the path may be relative, confirm the process's current working directory."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4efba2d113d165aaaf7533f5d2893e7cc57ebfc1","analyzedAt":"2026-09-09T16:24:23.306Z","contentChangedAt":"2026-09-09T16:24:23.306Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}