{"record":{"id":"254bd4b635fc36f5","repo":"phacility/phabricator","slug":"expected-s-got-s","errorCode":null,"errorMessage":"Expected '%s', got %s.","messagePattern":"Expected '(.+?)', got (.+?)\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/repository/worker/commitchangeparser/PhabricatorRepositorySvnCommitChangeParserWorker.php","lineNumber":719,"sourceCode":"          if ($line == '</list>') {\n            $done = true;\n            break 2;\n          } else if ($line == '<entry') {\n            $mode = 'entry';\n            $entry = array();\n          } else {\n            throw new Exception(\n              pht(\n                'Expected %s or %s, got %s.',\n                '</list>',\n                '<entry',\n                $line));\n          }\n          break;\n        case 'xml':\n          $expect = '/<?xml version=\"1.0\".*?>/';\n          if (!preg_match($expect, $line)) {\n            throw new Exception(\n              pht(\n                \"Expected '%s', got %s.\",\n                $expect,\n                $line));\n          }\n          $mode = 'list';\n          break;\n        case 'list':\n          $expect = '<lists>';\n          if ($line !== $expect) {\n            throw new Exception(\n              pht(\n                \"Expected '%s', got %s.\",\n                $expect,\n                $line));\n          }\n          $mode = 'list1';\n          break;","sourceCodeStart":701,"sourceCodeEnd":737,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/repository/worker/commitchangeparser/PhabricatorRepositorySvnCommitChangeParserWorker.php#L701-L737","documentation":"The first line of svn ls --xml output must match /^<?xml version=\"1.0\".*?>/; if svn prints any warning, banner, or error text before the declaration (or omits it), the parse throws immediately (PhabricatorRepositorySvnCommitChangeParserWorker.php:716-727). In practice this error usually masks the real problem: svn failed (auth, cert, connection) and emitted a message instead of XML.","triggerScenarios":"svn authentication failure or expired credentials printing an error instead of XML; SSL certificate warnings written to stdout; wrapper scripts or hooks adding banner output before the document.","commonSituations":"Expired SVN credentials; changed server certificates after admin renewal; locale or config noise from the svn client; misconfigured wrappers on the daemon host.","solutions":["Run the same svn ls --xml command manually as the daemon user - the real error is usually on the first lines","Fix the underlying svn problem: credentials, cert trust, network reachability","Remove any wrappers/banners so stdout contains only the XML document"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-flight the exact command the parser runs and check the first line:\n//   out=$(svn ls --xml <repo-url> 2>/dev/null); head -1 <<< \"$out\"\n// It must match ^<?xml version=\"1.0\".*?> - otherwise fix svn auth/cert/network first.","typeGuard":"function looksLikeSvnListXml($first_line) {\n  return (bool)preg_match('/<\\?xml version=\"1\\.0\".*\\?>/', $first_line);\n}","tryCatchPattern":"try {\n  $map = $this->parseSVNListXML($file_path);\n} catch (Exception $ex) {\n  // First line was not the XML declaration: svn almost certainly failed\n  // (auth/cert/network) and printed a message. Read the captured output,\n  // fix the underlying svn issue, then reparse.\n  phlog(file_get_contents($file_path));\n  throw new PhabricatorWorkerPermanentFailureException($ex->getMessage());\n}","preventionTips":["Monitor svn credentials and cert trust so svn never errors in place of XML","Run svn commands without wrappers or banners on daemon hosts","Log raw svn output on parse failure to expose the true svn error immediately"],"tags":["phabricator","svn","xml","parsing","authentication","php"],"backgroundTag":"vcs-output-parse-failure","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}