laurent22/joplin · error · Error

Unexpected git ls-remote output: "${remoteHeadLine}". Make s

Error message

Unexpected git ls-remote output: "${remoteHeadLine}". Make sure your git remote and branch are configured correctly.

What it means

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.)

Source

Thrown at packages/generator-joplin/generators/app/templates/webpack.config.js:54

const manifestPath = `${srcDir}/manifest.json`;
const packageJsonPath = `${rootDir}/package.json`;
const allPossibleScreenshotsType = ['jpg', 'jpeg', 'png', 'gif', 'webp'];
const manifest = readManifest(manifestPath);
const pluginArchiveFilePath = path.resolve(publishDir, `${manifest.id}.jpl`);
const pluginInfoFilePath = path.resolve(publishDir, `${manifest.id}.json`);

const { builtinModules } = require('node:module');

// Webpack5 doesn't polyfill by default and displays a warning when attempting to require() built-in
// node modules. Set these to false to prevent Webpack from warning about not polyfilling these modules.
// We don't need to polyfill because the plugins run in Electron's Node environment.
const moduleFallback = {};
for (const moduleName of builtinModules) {
	moduleFallback[moduleName] = false;
}

const getPackageJson = () => {
	return JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
};

function validatePackageJson() {
	const content = getPackageJson();
	if (!content.name || content.name.indexOf('joplin-plugin-') !== 0) {
		console.warn(chalk.yellow(`WARNING: To publish the plugin, the package name should start with "joplin-plugin-" (found "${content.name}") in ${packageJsonPath}`));
	}

	if (!content.keywords || content.keywords.indexOf('joplin-plugin') < 0) {
		console.warn(chalk.yellow(`WARNING: To publish the plugin, the package keywords should include "joplin-plugin" (found "${JSON.stringify(content.keywords)}") in ${packageJsonPath}`));
	}

	if (content.scripts && content.scripts.postinstall) {
		console.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}`));
	}
}

function fileSha256(filePath) {

View on GitHub (pinned to 2654b33620)

Solutions

  1. Run `git ls-remote origin <branch>` manually and inspect the raw output.
  2. Accept the SSH host key first: ssh -T git@github.com.
  3. Ensure the remote URL is a proper git URL (SSH or HTTPS), not a web page URL.
  4. Upgrade git to a current version if the output format is anomalous.

Example fix

# diagnose manually
git ls-remote origin main
# typical good output:
# 1a2b3c4...        refs/heads/main
# if SSH prompts, accept host key first:
ssh-keyscan github.com >> ~/.ssh/known_hosts
Defensive patterns

Strategy: validation

Validate before calling

const out = execSync(`git ls-remote origin ${branch}`, { encoding: 'utf8' }).trim();
const parts = out.split('\n')[0].split(/\s+/);
if (parts.length < 2) {
  throw new Error(`Malformed ls-remote output: ${JSON.stringify(out)}`);
}

Type guard

function isWellFormedLsRemote(out) {
  const parts = out.split('\n')[0].split(/\s+/);
  return parts.length >= 2;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of laurent22/joplin@2654b33620 (2026-08-12). Data as JSON: /api/errors/f4938922b6974313. Report an issue: GitHub.