{"record":{"id":"8fce75dde2632e7f","repo":"denisidoro/navi","slug":"not-found-in-cheatsh-output","errorCode":null,"errorMessage":"`{}` not found in cheatsh.\nOutput:\n{}\n","messagePattern":"`(.+?)` not found in cheatsh\\.\nOutput:\n(.+?)\n","errorType":"exception","errorClass":"anyhow","httpStatus":null,"severity":"error","filePath":"src/clients/cheatsh.rs","lineNumber":51,"sourceCode":"        }\n    };\n\n    let out = child.wait_with_output().context(\"Failed to wait for wget\")?;\n\n    if let Some(0) = out.status.code() {\n        let stdout = out.stdout;\n        let plain_bytes = strip_ansi_escapes::strip(stdout);\n\n        let markdown = String::from_utf8(plain_bytes).context(\"Output is invalid utf8\")?;\n        if markdown.starts_with(\"Unknown topic.\") {\n            let msg = format!(\n                \"`{}` not found in cheatsh.\nOutput:\n{}\n\",\n                &query, markdown,\n            );\n            return Err(anyhow!(msg));\n        }\n\n        let lines = as_lines(query, &markdown);\n        Ok(lines)\n    } else {\n        let msg = format!(\n            \"Failed to call:\nwget {}\n\nOutput:\n{}\n\nError:\n{}\n\",\n            args.join(\" \"),\n            String::from_utf8(out.stdout).unwrap_or_else(|_e| \"Unable to get output message\".to_string()),\n            String::from_utf8(out.stderr).unwrap_or_else(|_e| \"Unable to get error message\".to_string())","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/denisidoro/navi/blob/f7330b9ad5bd95b7d1a3c96d00e0a77deb589147/src/clients/cheatsh.rs#L33-L69","documentation":"After wget successfully fetches the cheat.sh page, `cheatsh::call` checks whether the queried topic exists. If the response doesn't contain the expected query (cheat.sh returns its 'unknown topic' page), navi returns an anyhow error embedding the query and the raw markdown output so the user can see what cheat.sh actually returned.","triggerScenarios":"`call(query)` where the downloaded markdown does not match the query: the topic doesn't exist on cheat.sh, the query is misspelled, or cheatsheet lookup uses a name cheat.sh doesn't know.","commonSituations":"Typos in the cheatsheet/topic name, querying a language/tool that cheat.sh doesn't cover, using a language code prefix incorrectly, or cheat.sh changing its response format so detection of 'not found' misfires.","solutions":["Check the spelling of the query/topic and search cheat.sh directly in a browser (`https://cheat.sh/<topic>`)","Use a topic that exists on cheat.sh or use a local cheatsheet directory instead","Inspect the Output section of the error to see what cheat.sh returned and adjust the query accordingly","If cheat.sh format changed, update navi to a newer version with fixed parsing"],"exampleFix":"// before\n$ navi cheatsh pyhton lists\n`pyhton lists` not found in cheatsh.\n// after\n$ navi cheatsh python lists","handlingStrategy":"try-catch","validationCode":"// verify the topic exists before calling\nfn topic_exists_on_cheatsh(topic: &str) -> bool {\n    std::process::Command::new(\"wget\").arg(\"-q\").arg(\"--spider\")\n        .arg(format!(\"https://cheat.sh/{}\", topic))\n        .status().map(|s| s.success()).unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":"match cheatsh::call(query, opts) {\n    Ok(lines) => render(lines),\n    Err(e) if e.to_string().contains(\"not found in cheatsh\") => {\n        eprintln!(\"topic '{}' does not exist on cheat.sh; check spelling\", query);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Verify topic names on cheat.sh before querying","Watch for cheat.sh response-format changes; keep navi updated","Fall back to local cheatsheets for obscure topics","Handle the Result instead of ignoring it"],"tags":["network","cheat-sh","not-found","query"],"backgroundTag":"resource-not-found","analyzedSha":"f7330b9ad5bd95b7d1a3c96d00e0a77deb589147","analyzedAt":"2026-09-03T13:58:22.429Z","contentChangedAt":"2026-09-03T13:58:22.429Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}