windmill-labs/windmill · warning · GitHubAppError

VALIDATION_ERROR

VALIDATION_ERROR

Error message

VALIDATION_ERROR | NETWORK_ERROR | AUTH_ERROR | UNKNOWN_ERROR

What it means

GitHubAppError is the standardized error type created by frontend/src/lib/githubApp.ts for all GitHub App related failures. Its `code` field classifies the failure: VALIDATION_ERROR (bad input like empty slug/installation id), NETWORK_ERROR (fetch failures), AUTH_ERROR (token/jwt problems), UNKNOWN_ERROR (anything else). The example shows code=VALIDATION_ERROR, thrown when inputs fail validation before any network call is made.

Source

Thrown at frontend/src/lib/githubApp.ts:34

	 * workspace), and matching on the org name resolves to the wrong one.
	 */
	selectedGHAppInstallationId: number | undefined
	selectedGHAppRepository: string | undefined
	githubInstallationUrl: string | undefined
	installationCheckInterval: number | undefined
	isCheckingInstallation: boolean
	importJwt: string
	/**
	 * True when the instance has a self-managed (GHES) GitHub App configured.
	 * Used to hide cloud-only UI like the Export/Import buttons, since those
	 * JWTs carry no `github_base_url` and would round-trip into broken
	 * github.com-pointed installs.
	 */
	isGhesSelfManaged: boolean
}

export interface GitHubAppError extends Error {
	code: 'VALIDATION_ERROR' | 'NETWORK_ERROR' | 'AUTH_ERROR' | 'UNKNOWN_ERROR'
	details?: unknown
}

/**
 * Creates a standardized GitHub App error
 */
function createGitHubAppError(
	message: string,
	code: GitHubAppError['code'],
	details?: unknown
): GitHubAppError {
	const error = new Error(message) as GitHubAppError
	error.code = code
	error.details = details
	return error
}

/**

View on GitHub (pinned to e474e8803c)

Solutions

  1. Inspect the error's `details` field — it carries which input failed validation.
  2. Validate inputs before calling: ensure the app slug is non-empty and installation id is numeric.
  3. Confirm isGhesSelfManaged matches the host you pass (github.com vs a GHES base URL).
  4. Trim and decode any values taken from URL query params before use.
  5. If the classification looks wrong, check that the throw site passes the correct code to createGitHubAppError.

Example fix

// before
await completeInstallation(slug) // slug may be ''
// after
if (!slug || typeof slug !== 'string' || !slug.trim()) {
  throw createGitHubAppError('VALIDATION_ERROR', 'App slug is required', { slug })
}
await completeInstallation(slug.trim())
Defensive patterns

Strategy: validation

Validate before calling

export function assertValidInstallInput(slug: string, installationId: string, isGhesSelfManaged: boolean): void {
  if (!slug?.trim()) throw createGitHubAppError('VALIDATION_ERROR', 'slug required', { slug })
  if (!/^\d+$/.test(String(installationId))) throw createGitHubAppError('VALIDATION_ERROR', 'installationId must be numeric', { installationId })
  if (isGhesSelfManaged === undefined) throw createGitHubAppError('VALIDATION_ERROR', 'isGhesSelfManaged required')
}

Type guard

function isGitHubAppError(e: unknown): e is GitHubAppError {
  return e instanceof Error && ['VALIDATION_ERROR','NETWORK_ERROR','AUTH_ERROR','UNKNOWN_ERROR'].includes((e as GitHubAppError).code)
}

Try / catch

try {
  const url = buildInstallUrl(input)
} catch (e) {
  if (isGitHubAppError(e) && e.code === 'VALIDATION_ERROR') {
    console.error('Invalid GitHub App input', e.details)
  } else { throw e }
}

Prevention

When it happens

Trigger: Calling a githubApp.ts helper (e.g. buildInstallationUrl or similar) with invalid arguments — an empty or malformed GitHub App slug, a non-numeric installation id, or a github.com vs GHES hostname mismatch — causing createGitHubAppError to be invoked with code 'VALIDATION_ERROR'.

Common situations: Passing an empty string for the app slug from unset settings/env; pasting a GHES URL into a github.com-pointed install form or vice versa; whitespace or URL-encoded values in the installation id; tests constructing the error with the wrong discriminant.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/1231b2112aedd0d6. Report an issue: GitHub.