{"record":{"id":"fc2fe177ea923274","repo":"nikivdev/code","slug":"selection-out-of-range-fc2fe1","errorCode":null,"errorMessage":"Selection out of range","messagePattern":"Selection out of range","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/env.rs","lineNumber":2204,"sourceCode":"        if selected.is_empty() {\n            return Ok(None);\n        }\n        let id = selected.split('\\t').next().unwrap_or(selected);\n        return Ok(templates.iter().copied().find(|t| t.id == id));\n    }\n\n    println!(\"Available templates:\");\n    for (idx, template) in templates.iter().enumerate() {\n        println!(\"  {}. {} ({})\", idx + 1, template.title, template.key);\n    }\n    println!();\n    let selection = prompt_line(\"Select a template number (blank to cancel): \")?;\n    let Some(selection) = selection else {\n        return Ok(None);\n    };\n    let idx: usize = selection.trim().parse().context(\"Invalid selection\")?;\n    if idx == 0 || idx > templates.len() {\n        bail!(\"Selection out of range\");\n    }\n    Ok(Some(templates[idx - 1]))\n}\n\nfn ensure_env_login() -> Result<()> {\n    let auth = load_auth_config()?;\n    if auth.token.is_some() {\n        return Ok(());\n    }\n\n    if !std::io::stdin().is_terminal() {\n        bail!(\"Not logged in. Run `f env login` first.\");\n    }\n\n    if prompt_confirm(\"Not logged in. Run `f env login` now? (y/N): \")? {\n        login()?;\n        return Ok(());\n    }","sourceCodeStart":2186,"sourceCodeEnd":2222,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/env.rs#L2186-L2222","documentation":"Error \"Selection out of range\" thrown in nikivdev/code.","triggerScenarios":"Thrown at src/env.rs:2204 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":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}