{"record":{"id":"46468a62f209cc92","repo":"phacility/phabricator","slug":"you-must-enter-an-ldap-username","errorCode":null,"errorMessage":"You must enter an LDAP username.","messagePattern":"You must enter an LDAP username\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php","lineNumber":40,"sourceCode":"      $console->writeOut(\n        \"%s\\n\",\n        pht('The LDAP authentication provider is not enabled.'));\n      exit(1);\n    }\n\n    if (!function_exists('ldap_connect')) {\n      $console->writeOut(\n        \"%s\\n\",\n        pht('The LDAP extension is not enabled.'));\n      exit(1);\n    }\n\n    $adapter = $provider->getAdapter();\n\n    $console->writeOut(\"%s\\n\", pht('Enter LDAP Credentials'));\n    $username = phutil_console_prompt(pht('LDAP Username: '));\n    if (!strlen($username)) {\n      throw new PhutilArgumentUsageException(\n        pht('You must enter an LDAP username.'));\n    }\n\n    phutil_passthru('stty -echo');\n    $password = phutil_console_prompt(pht('LDAP Password: '));\n    phutil_passthru('stty echo');\n\n    if (!strlen($password)) {\n      throw new PhutilArgumentUsageException(\n        pht('You must enter an LDAP password.'));\n    }\n\n    $adapter->setLoginUsername($username);\n    $adapter->setLoginPassword(new PhutilOpaqueEnvelope($password));\n\n    $console->writeOut(\"\\n\");\n    $console->writeOut(\"%s\\n\", pht('Connecting to LDAP...'));\n","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php#L22-L58","documentation":"The bin/auth ldap workflow interactively prompts for LDAP credentials to test the provider's bind; phutil_console_prompt returns an empty LDAP username and the workflow aborts with PhutilArgumentUsageException before prompting for the password.","triggerScenarios":"Pressing Enter at the 'LDAP Username:' prompt without typing anything, or running the command where stdin is closed so the prompt reads empty.","commonSituations":"Misfired Enter; probing whether the prompt is mandatory; invoking the interactive workflow from a script without stdin attached.","solutions":["Re-run and enter a real LDAP username (typically your own test/bind user), then the password.","Run the command from an interactive shell — this workflow takes no CLI arguments.","Confirm the LDAP extension is loaded and the LDAP provider is enabled (the workflow exits earlier otherwise)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run bin/auth ldap from a real interactive terminal.","Have the test username and password ready before starting.","The workflow prompts for everything; it accepts no CLI arguments."],"tags":["cli","ldap","empty-input","phabricator"],"backgroundTag":"empty-cli-input","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}