badges/shields · error · InvalidParameter

package not found

Error message

package not found

What it means

The winget base service throws InvalidParameter 'package not found' when the GitHub GraphQL query against microsoft/winget-pkgs returns no repository object entries, meaning no manifest directory exists for the requested package name.

Source

Thrown at services/winget/winget-base.js:112

            object(expression: $expression) {
              ... on Blob {
                text
              }
            }
          }
        }
      `,
      variables: { expression },
      schema: manifestSchema,
      transformErrors,
    })
  }

  // Returns the latest version string for a package, or throws if not found.
  async getLatestVersion({ name }) {
    const json = await this.fetchVersions({ name })
    if (json.data.repository.object?.entries == null) {
      throw new InvalidParameter({ prettyMessage: 'package not found' })
    }
    const entries = json.data.repository.object.entries
    const directories = entries.filter(entry => entry.type === 'tree')
    const versionDirs = directories.filter(dir =>
      dir.object.entries.some(
        file => file.type === 'blob' && file.name === `${name}.yaml`,
      ),
    )
    const version = latest(versionDirs.map(dir => dir.name))
    if (version == null) {
      throw new InvalidParameter({ prettyMessage: 'no versions found' })
    }
    return version
  }
}

View on GitHub (pinned to 766fd8bc89)

Solutions

  1. Run 'winget search <name>' or check the Microsoft community repository to get the exact package id
  2. Use the full case-correct id like 'VideoLAN.VLC' rather than the app name
  3. If the package is only in a custom source, this badge (community repo based) will not find it
  4. Remove or replace the badge if the package is not in winget

Example fix

// before
getLatestVersion({ name: 'vlc' })
// after
getLatestVersion({ name: 'VideoLAN.VLC' })
Defensive patterns

Strategy: validation

Validate before calling

// check the package id exists in the winget community repo before rendering
const res = await fetch(`https://github.com/microsoft/winget-pkgs/tree/master/manifests/${id.replace('.', '/')}`)
if (!res.ok) throw new Error(`winget package not found: ${id}`);

Type guard

function hasWingetEntries(json) { return json?.data?.repository?.object?.entries != null }

Try / catch

try {
  const version = await service.getLatestVersion({ name })
} catch (e) {
  if (e.message === 'package not found') {
    // fallback: display 'unknown' or use 'winget search' to find the right id
  } else throw e
}

Prevention

When it happens

Trigger: Calling getLatestVersion with a package id that does not exist in the winget-pkgs repository, e.g. wrong publisher prefix or a package never packaged for winget.

Common situations: Using display name instead of the winget package id, missing publisher segment (e.g. 'Git.Git' vs 'Git'), package removed from winget, package available only in a custom source.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of badges/shields@766fd8bc89 (2026-08-30). Data as JSON: /api/errors/b05e594c03b6f7c6. Report an issue: GitHub.