composer/composer · error · InvalidArgumentException

DiagnoseCommand: Unknown warning type "%s". Please report at

Error message

DiagnoseCommand: Unknown warning type "%s". Please report at https://github.com/composer/composer/issues/new.

What it means

Symmetric to the unknown-error-type guard: thrown inside the warnings loop of DiagnoseCommand when a warning key is not recognized by its switch. It exists so that no warning silently passes without explanation, forcing a bug report for unhandled categories.

Source

Thrown at src/Composer/Command/DiagnoseCommand.php:909

                    case 'xdebug_profile':
                        $text = "The xdebug.profiler_enabled setting is enabled, this can slow down Composer a lot.".PHP_EOL;
                        $text .= "Add the following to the end of your `php.ini` to disable it:".PHP_EOL;
                        $text .= "  xdebug.profiler_enabled = 0";
                        $displayIniMessage = true;
                        break;

                    case 'onedrive':
                        $text = "The Windows OneDrive folder is not supported on PHP versions below 7.2.23 and 7.3.10.".PHP_EOL;
                        $text .= "Upgrade your PHP ({$current}) to use this location with Composer.".PHP_EOL;
                        break;

                    case 'uopz':
                        $text = "The uopz extension ignores exit calls and may not work with all Composer commands.".PHP_EOL;
                        $text .= "Disabling it when using Composer is recommended.";
                        break;

                    default:
                        throw new \InvalidArgumentException(sprintf("DiagnoseCommand: Unknown warning type \"%s\". Please report at https://github.com/composer/composer/issues/new.", $warning));
                }
                $out($text, 'comment');
            }
        }

        if ($displayIniMessage) {
            $out($iniMessage, 'comment');
        }

        if (in_array(Platform::getEnv('COMPOSER_IPRESOLVE'), ['4', '6'], true)) {
            $warnings['ipresolve'] = true;
            $out('The COMPOSER_IPRESOLVE env var is set to ' . Platform::getEnv('COMPOSER_IPRESOLVE') .' which may result in network failures below.', 'comment');
        }

        return count($warnings) === 0 && count($errors) === 0 ? true : $output;
    }

    /**

View on GitHub (pinned to 6ffc117740)

Solutions

  1. Upgrade Composer: `composer self-update`.
  2. Re-run `composer diagnose`.
  3. Report the issue at the Composer GitHub tracker with full output if it persists.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    $app->run(); // composer diagnose
} catch (\InvalidArgumentException $e) {
    if (str_contains($e->getMessage(), 'DiagnoseCommand: Unknown warning type')) {
        // Upgrade composer; re-run diagnose; report if unresolved.
    }
}

Prevention

When it happens

Trigger: Running `composer diagnose` and hitting a warning classification key not present in the switch (apc_cli, zlib, sigchild, curlwrappers, openssl_version, xdebug_loaded, xdebug_profile, onedrive, uopz). Reachable mainly via a Composer regression or an unrecognized PHP environment.

Common situations: Extremely rare; would point to a Composer build that is out of sync with the PHP environment it is diagnosing, or a custom/patched Composer.

Related errors


AI-assisted analysis of composer/composer@6ffc117740 (2026-08-07). Data as JSON: /api/errors/59ceaa8f2b62bc60. Report an issue: GitHub.