{"record":{"id":"f4938922b6974313","repo":"laurent22/joplin","slug":"unexpected-git-ls-remote-output-remoteheadline","errorCode":null,"errorMessage":"Unexpected git ls-remote output: \"${remoteHeadLine}\". Make sure your git remote and branch are configured correctly.","messagePattern":"Unexpected git ls-remote output: \"(.+?)\"\\. Make sure your git remote and branch are configured correctly\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/generator-joplin/generators/app/templates/webpack.config.js","lineNumber":54,"sourceCode":"const manifestPath = `${srcDir}/manifest.json`;\nconst packageJsonPath = `${rootDir}/package.json`;\nconst allPossibleScreenshotsType = ['jpg', 'jpeg', 'png', 'gif', 'webp'];\nconst manifest = readManifest(manifestPath);\nconst pluginArchiveFilePath = path.resolve(publishDir, `${manifest.id}.jpl`);\nconst pluginInfoFilePath = path.resolve(publishDir, `${manifest.id}.json`);\n\nconst { builtinModules } = require('node:module');\n\n// Webpack5 doesn't polyfill by default and displays a warning when attempting to require() built-in\n// node modules. Set these to false to prevent Webpack from warning about not polyfilling these modules.\n// We don't need to polyfill because the plugins run in Electron's Node environment.\nconst moduleFallback = {};\nfor (const moduleName of builtinModules) {\n\tmoduleFallback[moduleName] = false;\n}\n\nconst getPackageJson = () => {\n\treturn JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));\n};\n\nfunction validatePackageJson() {\n\tconst content = getPackageJson();\n\tif (!content.name || content.name.indexOf('joplin-plugin-') !== 0) {\n\t\tconsole.warn(chalk.yellow(`WARNING: To publish the plugin, the package name should start with \"joplin-plugin-\" (found \"${content.name}\") in ${packageJsonPath}`));\n\t}\n\n\tif (!content.keywords || content.keywords.indexOf('joplin-plugin') < 0) {\n\t\tconsole.warn(chalk.yellow(`WARNING: To publish the plugin, the package keywords should include \"joplin-plugin\" (found \"${JSON.stringify(content.keywords)}\") in ${packageJsonPath}`));\n\t}\n\n\tif (content.scripts && content.scripts.postinstall) {\n\t\tconsole.warn(chalk.yellow(`WARNING: package.json contains a \"postinstall\" script. It is recommended to use a \"prepare\" script instead so that it is executed before publish. In ${packageJsonPath}`));\n\t}\n}\n\nfunction fileSha256(filePath) {","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/laurent22/joplin/blob/2654b33620775080d1d59c552259d41e33dad3d2/packages/generator-joplin/generators/app/templates/webpack.config.js#L36-L72","documentation":"Thrown by verifyGitState when `git ls-remote origin <branch>` output, after splitting on newline then whitespace, yields fewer than 2 parts. Valid ls-remote output is '<40-hex-sha>\\trefs/heads/<branch>'. Fewer than 2 parts means the output is malformed — possibly a ref advertisement with unexpected formatting, a truncated line, or an SSH/credential prompt leaking into stdout. (Note: the error's file attribution to webpack.config.js is a mismatch; the message and logic live in verifyGitState.ts line 54.)","triggerScenarios":"git ls-remote printed a banner/warning instead of a ref line; SSH known_hosts prompt wrote to stdout; a git wrapper or alias altered output; the remote URL returns a non-ref line (e.g. an HTML error page captured as stdout via a misconfigured remote); partial output from a flaky connection.","commonSituations":"First connect to a new SSH remote where the host key prompt appears; a proxy/gateway injected text; git version producing a different ls-remote format; remote URL points to a web URL returning HTML.","solutions":["Run `git ls-remote origin <branch>` manually and inspect the raw output.","Accept the SSH host key first: ssh -T git@github.com.","Ensure the remote URL is a proper git URL (SSH or HTTPS), not a web page URL.","Upgrade git to a current version if the output format is anomalous."],"exampleFix":"# diagnose manually\ngit ls-remote origin main\n# typical good output:\n# 1a2b3c4...        refs/heads/main\n# if SSH prompts, accept host key first:\nssh-keyscan github.com >> ~/.ssh/known_hosts","handlingStrategy":"validation","validationCode":"const out = execSync(`git ls-remote origin ${branch}`, { encoding: 'utf8' }).trim();\nconst parts = out.split('\\n')[0].split(/\\s+/);\nif (parts.length < 2) {\n  throw new Error(`Malformed ls-remote output: ${JSON.stringify(out)}`);\n}","typeGuard":"function isWellFormedLsRemote(out) {\n  const parts = out.split('\\n')[0].split(/\\s+/);\n  return parts.length >= 2;\n}","tryCatchPattern":null,"preventionTips":["Accept the SSH host key before publishing: ssh -T git@github.com.","Ensure the remote URL is a proper git URL, not a web page.","Inspect raw `git ls-remote` output if the error recurs."],"tags":["plugin-publish","git","generator-joplin","remote","ssh"],"backgroundTag":null,"analyzedSha":"2654b33620775080d1d59c552259d41e33dad3d2","analyzedAt":"2026-08-12T14:26:46.263Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}