{"record":{"id":"f0ec7051d7f55eef","repo":"zaproxy/zaproxy","slug":"conn-options-proxy-username-empty","errorCode":null,"errorMessage":"conn.options.proxy.username.empty","messagePattern":"conn\\.options\\.proxy\\.username\\.empty","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"warning","filePath":"zap/src/main/java/org/parosproxy/paros/extension/option/OptionsConnectionPanel.java","lineNumber":662,"sourceCode":"        chkShowPassword.setEnabled(!isEnabled);\n    }\n\n    @Override\n    public void validateParam(Object obj) throws Exception {\n\n        if (chkUseProxyChain.isSelected()) {\n            // ZAP: empty proxy name validation\n            if (txtProxyChainName.getText().isEmpty()) {\n                txtProxyChainName.requestFocus();\n                throw new Exception(\n                        Constant.messages.getString(\"conn.options.proxy.address.empty\"));\n            }\n\n            if (chkProxyChainAuth.isSelected()\n                    && !chkProxyChainPrompt.isSelected()\n                    && txtProxyChainUserName.getText().isEmpty()) {\n                txtProxyChainUserName.requestFocus();\n                throw new Exception(\n                        Constant.messages.getString(\"conn.options.proxy.username.empty\"));\n            }\n        }\n\n        securityProtocolsPanel.validateSecurityProtocols();\n\n        socksProxyPanel.validateParam();\n    }\n\n    @Override\n    public void saveParam(Object obj) throws Exception {\n\n        OptionsParam optionsParam = (OptionsParam) obj;\n        org.parosproxy.paros.network.ConnectionParam connectionParam =\n                optionsParam.getConnectionParam();\n\n        connectionParam.setProxyChainName(txtProxyChainName.getText());\n        // ZAP: Do not allow invalid port numbers","sourceCodeStart":644,"sourceCodeEnd":680,"githubUrl":"https://github.com/zaproxy/zaproxy/blob/9d1970a436b1b189bfb588fc88864c80d9baf6a5/zap/src/main/java/org/parosproxy/paros/extension/option/OptionsConnectionPanel.java#L644-L680","documentation":"validateParam() in OptionsConnectionPanel also validates proxy-chain authentication fields. When proxy chain authentication is enabled and 'Prompt on authentication failure' is not selected, the proxy username must not be empty; otherwise a generic Exception with the i18n key conn.options.proxy.username.empty is thrown and the username field receives focus.","triggerScenarios":"Options > Connection with 'Use proxy chain' + 'Proxy chain authentication' checked, 'Prompt...' unchecked, and the Username field left blank when saving.","commonSituations":"Enabling authenticated upstream proxy but forgetting credentials; clearing the username while keeping auth enabled; headless/config-file setups that toggle auth without setting the username.","solutions":["Enter the upstream proxy username in the authentication section","Tick 'Prompt on authentication failure' to supply credentials interactively instead","Disable 'Proxy chain authentication' if the upstream proxy needs no auth"],"exampleFix":"// before\nchkProxyChainAuth.setSelected(true); // empty username -> 'conn.options.proxy.username.empty'\n// after\nchkProxyChainAuth.setSelected(true);\ntxtProxyChainUserName.setText(\"proxyuser\");\ntxtProxyChainPassword.setText(\"secret\");","handlingStrategy":"validation","validationCode":"if (useProxyChain && chainAuth && !promptForCreds && (username == null || username.isEmpty())) {\n    // require username (or enable 'Prompt on authentication failure') before saving\n}","typeGuard":null,"tryCatchPattern":"try {\n    optionsPanel.validateParam(connectionOptions);\n} catch (Exception e) {\n    if (\"conn.options.proxy.username.empty\".equals(e.getMessage())) {\n        focusUsernameField();\n    }\n}","preventionTips":["When enabling proxy-chain auth, immediately supply username/password","Use 'Prompt on authentication failure' when credentials are unknown at config time","Validate dependent fields together (checkbox + auth + credentials)","Keep proxy credentials in a config source, not empty placeholders"],"tags":["ui","validation","options-dialog","proxy-auth"],"backgroundTag":"empty-required-field","analyzedSha":"9d1970a436b1b189bfb588fc88864c80d9baf6a5","analyzedAt":"2026-09-05T19:26:59.356Z","contentChangedAt":"2026-09-05T19:26:59.356Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}