badges/shields · error · InvalidResponse

invalid response data

Error message

invalid response data

What it means

InvalidResponse thrown by the SDKMAN version badge when the fetched response body trims to an empty string. The upstream SDKMAN broker endpoint returned a 200 with no usable version text, so no version badge can be rendered.

Source

Thrown at services/sdkman/sdkman-version.service.js:37

        }),
      },
    },
  }

  static defaultBadgeData = { label: 'sdkman' }

  async fetch({ candidate }) {
    return this._request({
      url: `https://api.sdkman.io/2/candidates/default/${candidate}`,
      httpErrors: { 400: 'not found' },
    })
  }

  async handle({ candidate }) {
    const { buffer } = await this.fetch({ candidate })
    const version = buffer.trim()
    if (!version) {
      throw new InvalidResponse({ prettyMessage: 'invalid response data' })
    }
    return renderVersionBadge({ version })
  }
}

View on GitHub (pinned to 766fd8bc89)

Solutions

  1. Verify the candidate name against `sdk list` output or SDKMAN's candidates (e.g. java, groovy, gradle, kotlin, maven)
  2. Fix the candidate parameter in the badge URL to the exact SDKMAN slug
  3. Retry later if the SDKMAN broker was intermittently returning empty responses
  4. Check https://sdkman.io/sdks for the canonical candidate identifiers

Example fix

// before
https://img.shields.io/sdkman/v/sdk/java-linuxmac
// after (valid candidate slug)
https://img.shields.io/sdkman/v/java
Defensive patterns

Strategy: validation

Validate before calling

// Validate the candidate against SDKMAN's known candidates
const SDKMAN_CANDIDATES = ['java','groovy','gradle','kotlin','maven','sbt','scala','springboot','vertx','micronaut','quarkus','kscript','jbake','visualvm','jakartaee','activemq','ant','aspectj','bv','cfx','concurnas','connexion','crash','cuba','dataloader','debian','doctoolchain','dmnd','flow','flock','glide','golo','gradleprofiler','grails','groovydsl']
function isValidCandidate(candidate) {
  return SDKMAN_CANDIDATES.includes(candidate)
}
if (!isValidCandidate('java')) throw new Error('unknown SDKMAN candidate')

Try / catch

try {
  const badge = await fetchBadgeUrl(sdkmanBadgeUrl)
} catch (e) {
  if (/invalid response data/.test(e.message)) {
    console.warn('SDKMAN returned no version: check the candidate name')
  } else throw e
}

Prevention

When it happens

Trigger: Requesting an SDKMAN version badge with a `candidate` that the SDKMAN broker endpoint does not recognize (it returns an empty body instead of an error), or a transient empty response from the broker.

Common situations: Typo in the candidate name (e.g. 'scala' vs actual broker slug, renamed candidates); querying a candidate only available in newer SDKMAN broker data; SDKMAN service briefly returning empty bodies.

Related errors


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