{"record":{"id":"dcec7e539a17aef2","repo":"composer/composer","slug":"invalid-value-for-bin-compat-value-expected","errorCode":null,"errorMessage":"Invalid value for 'bin-compat': {$value}. Expected auto, full or proxy","messagePattern":"Invalid value for 'bin-compat': (.+?)\\. Expected auto, full or proxy","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/Composer/Config.php","lineNumber":472,"sourceCode":"\n                return max(0, (int) $size);\n\n            // special cases below\n            case 'cache-files-ttl':\n                if (isset($this->config[$key])) {\n                    return max(0, (int) $this->config[$key]);\n                }\n\n                return $this->get('cache-ttl');\n\n            case 'home':\n                return rtrim($this->process(Platform::expandPath($this->config[$key]), $flags), '/\\\\');\n\n            case 'bin-compat':\n                $value = $this->getComposerEnv('COMPOSER_BIN_COMPAT') ?: $this->config[$key];\n\n                if (!in_array($value, ['auto', 'full', 'proxy', 'symlink'])) {\n                    throw new \\RuntimeException(\n                        \"Invalid value for 'bin-compat': {$value}. Expected auto, full or proxy\"\n                    );\n                }\n\n                if ($value === 'symlink') {\n                    trigger_error('config.bin-compat \"symlink\" is deprecated since Composer 2.2, use auto, full (for Windows compatibility) or proxy instead.', E_USER_DEPRECATED);\n                }\n\n                return $value;\n\n            case 'discard-changes':\n                $env = $this->getComposerEnv('COMPOSER_DISCARD_CHANGES');\n                if ($env !== false) {\n                    if (!in_array($env, ['stash', 'true', 'false', '1', '0'], true)) {\n                        throw new \\RuntimeException(\n                            \"Invalid value for COMPOSER_DISCARD_CHANGES: {$env}. Expected 1, 0, true, false or stash\"\n                        );\n                    }","sourceCodeStart":454,"sourceCodeEnd":490,"githubUrl":"https://github.com/composer/composer/blob/c435d285c9120efdca35696769c72ea9fdcc0466/src/Composer/Config.php#L454-L490","documentation":"Thrown by Config::get() for 'bin-compat' when the resolved value is not one of auto/full/proxy/symlink. The bin-compat setting controls how Composer installs package binaries (vendor/bin) for cross-platform compatibility. The error message lists auto, full, proxy (symlink is accepted but deprecated since 2.2).","triggerScenarios":"Setting config.bin-compat in composer.json or COMPOSER_BIN_COMPAT env var to an invalid string. Guard at line 471: `!in_array($value, ['auto','full','proxy','symlink'])`.","commonSituations":"Typo (e.g. 'compat', 'full2', 'TRUE'), wrong casing ('Auto'), or copy-pasting an outdated value. The COMPOSER_BIN_COMPAT env var silently overrides config so a stray export can also cause it.","solutions":["Set a valid value: `composer config bin-compat auto` (or 'full' for Windows-compat, 'proxy' for shims).","Check COMPOSER_BIN_COMPAT env var: `echo $COMPOSER_BIN_COMPAT` and unset if stale.","Edit composer.json config.bin-compat to \"auto\", \"full\", \"proxy\" (\"symlink\" deprecated).","Run `composer validate` to confirm the config parses."],"exampleFix":"// before (composer.json)\n\"config\": { \"bin-compat\": \"compat\" }\n\n// after\n\"config\": { \"bin-compat\": \"full\" }","handlingStrategy":"validation","validationCode":"function isValidBinCompat(string $v): bool {\n    return in_array(strtolower($v), ['auto','full','proxy','symlink'], true);\n}\n$val = getenv('COMPOSER_BIN_COMPAT') ?: ($config['bin-compat'] ?? 'auto');\nif (!isValidBinCompat((string) $val)) {\n    throw new \\InvalidArgumentException(\"Invalid bin-compat: $val\");\n}","typeGuard":"function isValidBinCompat(string $v): bool {\n    return in_array(strtolower($v), ['auto','full','proxy','symlink'], true);\n}","tryCatchPattern":null,"preventionTips":["Restrict bin-compat to 'auto', 'full', or 'proxy' (avoid deprecated 'symlink').","Check for a stale COMPOSER_BIN_COMPAT env var when debugging.","Run `composer validate` after changing config.bin-compat."],"tags":["config","bin-compat","validation","env","composer-json"],"backgroundTag":null,"analyzedSha":"c435d285c9120efdca35696769c72ea9fdcc0466","analyzedAt":"2026-08-07T18:58:23.525Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}