{"record":{"id":"754e344f8c00b221","repo":"PyO3/pyo3","slug":"invalid-config-that-sets-both-target-abi-and-abi3","errorCode":null,"errorMessage":"Invalid config that sets both target_abi and abi3.","messagePattern":"Invalid config that sets both target_abi and abi3\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pyo3-build-config/src/impl_.rs","lineNumber":779,"sourceCode":"                    parse_value!(suppress_build_script_link_lines, value)\n                }\n                \"extra_build_script_line\" => {\n                    extra_build_script_lines.push(value.to_string());\n                }\n                \"python_framework_prefix\" => parse_value!(python_framework_prefix, value),\n                unknown => warn!(\"unknown config key `{}`\", unknown),\n            }\n        }\n\n        let version = version.ok_or(\"missing value for version\")?;\n        let implementation = implementation.unwrap_or(PythonImplementation::CPython);\n        let flags_contains_free_threaded = if let Some(ref flags) = build_flags {\n            flags.0.contains(&BuildFlag::Py_GIL_DISABLED)\n        } else {\n            false\n        };\n        let target_abi = if let Some(target_abi) = target_abi {\n            ensure!(\n                abi3.is_none(),\n                \"Invalid config that sets both target_abi and abi3.\"\n            );\n            target_abi\n        } else if flags_contains_free_threaded {\n            // This fires even if is_abi3() is True for backward compatibility reasons\n            PythonAbiBuilder::new(implementation, version)\n                .free_threaded()\n                .finalize()?\n        } else if abi3 == Some(true) {\n            warn!(\"abi3 configuration file option is deprecated since pyo3 0.29, set target_abi instead\");\n            PythonAbiBuilder::new(implementation, version)\n                .stable_abi(StableAbi::Abi3)\n                .finalize()?\n        } else {\n            PythonAbiBuilder::new(implementation, version).finalize()?\n        };\n","sourceCodeStart":761,"sourceCodeEnd":797,"githubUrl":"https://github.com/PyO3/pyo3/blob/ac9b6899d348be4d54614d060dea53a645a12e36/pyo3-build-config/src/impl_.rs#L761-L797","documentation":"A PYO3_CONFIG_FILE may specify the ABI either via the legacy `abi3` flag or the newer `target_abi` field, but not both. from_reader rejects a config that sets both to avoid ambiguity about which ABI actually applies.","triggerScenarios":"Hand-editing or tool-generating a pyo3 config file that contains both an `abi3` line and a `target_abi` line; merging config snippets or upgrading a config file from an older pyo3 format by adding target_abi without removing abi3.","commonSituations":"Manually migrating a config written for old pyo3 to the new format; copy-pasting example config files and combining sections; build tooling that appends target_abi unconditionally to a template that already contains abi3.","solutions":["Edit the config file and remove the `abi3` line, keeping `target_abi` (or vice versa)","Regenerate the config file with the pyo3 tooling for your pyo3 version instead of hand-editing","Verify with `python -m pyo3_build_config`-style tooling or the pyo3 docs which format your pyo3 version expects"],"exampleFix":"# pyo3-config.txt, before\nabi3\ntarget_abi=abi3-cp312\n# after\ntarget_abi=abi3-cp312","handlingStrategy":"validation","validationCode":"// shell\ngrep -q '^abi3' \"$PYO3_CONFIG_FILE\" && grep -q '^target_abi' \"$PYO3_CONFIG_FILE\" && echo 'config sets both abi3 and target_abi — remove one'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use only the current-format target_abi field in hand-written configs","Regenerate configs with pyo3 tooling rather than merging old and new formats","Validate custom config files after every pyo3 upgrade"],"tags":["rust","pyo3","config-file","schema-validation","abi3","build-time"],"backgroundTag":"config-file-conflicting-fields","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"}