{"record":{"id":"656640409cfaf6a5","repo":"PyO3/pyo3","slug":"unrecognized-target-environment-variable-value","errorCode":null,"errorMessage":"Unrecognized TARGET environment variable value","messagePattern":"Unrecognized TARGET environment variable value","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pyo3-build-config/src/impl_.rs","lineNumber":74,"sourceCode":"pub fn env_var(var: &str) -> Option<OsString> {\n    println!(\"cargo:rerun-if-env-changed={var}\");\n    #[cfg(test)]\n    {\n        READ_ENV_VARS.with(|env_vars| {\n            env_vars.borrow_mut().push(var.to_owned());\n        });\n    }\n    env::var_os(var)\n}\n\n/// Gets the compilation target triple from environment variables set by Cargo.\n///\n/// Must be called from a crate build script.\npub fn target_triple_from_env() -> Triple {\n    env::var(\"TARGET\")\n        .expect(\"target_triple_from_env() must be called from a build script\")\n        .parse()\n        .expect(\"Unrecognized TARGET environment variable value\")\n}\n\nfn sanitize_stable_abi_version(\n    stable_abi_version: Option<PythonVersion>,\n    version: PythonVersion,\n) -> Result<PythonVersion> {\n    if let Some(min_version) = stable_abi_version {\n        ensure!(\n            min_version <= version,\n            \"cannot set a minimum Python version {} higher than the interpreter version {} \\\n             (the minimum Python version is implied by the abi3-py3{} feature)\",\n            min_version,\n            version,\n            min_version.minor\n        );\n        Ok(min_version)\n    } else {\n        Ok(version)","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/PyO3/pyo3/blob/ac9b6899d348be4d54614d060dea53a645a12e36/pyo3-build-config/src/impl_.rs#L56-L92","documentation":"Panic while parsing the TARGET environment variable into a Triple: the value exists but does not parse as a known Rust target triple (malformed, custom, or unsupported string), so the .parse().expect() aborts. The faulty input is the TARGET value itself as set by Cargo or the environment.","triggerScenarios":"Thrown at pyo3-build-config/src/impl_.rs:74 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the --target argument / TARGET value for typos or stray characters","Use a triple known to rustc (rustc --print target-list)","For custom targets, extend parsing in pyo3-build-config to recognize the triple"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ac9b6899d348be4d54614d060dea53a645a12e36","analyzedAt":"2026-09-05T09:20:35.319Z","contentChangedAt":"2026-09-05T09:20:35.319Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}