badges/shields · error · InvalidResponse

no result

Error message

no result

What it means

After evaluating the JSONPath query against the fetched JSON, the service checks the result array. If the query matched nothing (undefined or empty), it throws InvalidResponse with prettyMessage 'no result' — the upstream JSON was reachable but contained no data at the queried path.

Source

Thrown at services/dynamic/json-path.js:64

      let values
      try {
        values = jp({ json: data, path: pathExpression, eval: false })
      } catch (e) {
        const { message } = e
        if (
          message.includes('prevented in JSONPath expression') ||
          e instanceof TypeError
        ) {
          throw new InvalidParameter({
            prettyMessage: 'query not supported',
          })
        } else {
          throw e
        }
      }

      if (!values || !values.length) {
        throw new InvalidResponse({ prettyMessage: 'no result' })
      }

      return renderDynamicBadge({ value: values, prefix, suffix })
    }
  }

View on GitHub (pinned to 766fd8bc89)

Solutions

  1. Fetch the url manually and run the JSONPath query against the actual payload to find the correct path
  2. Update the query to the new schema location of the value
  3. Guard against empty collections by pointing at an endpoint that guarantees the key exists
  4. Add prefix/suffix only after a match is confirmed

Example fix

// before
/badge/dynamic/json?url=https://api.example.com/pkg&query=$.data.latest
// after (API returns { result: { latest: ... } })
/badge/dynamic/json?url=https://api.example.com/pkg&query=$.result.latest
Defensive patterns

Strategy: validation

Validate before calling

const jsonpath = require('jsonpath')
async function queryHasResult(url, query) {
  const res = await fetch(url)
  const json = await res.json()
  const values = jsonpath.query(json, query)
  return Array.isArray(values) && values.length > 0
}
// check before displaying the badge

Try / catch

try {
  const badge = await getJsonPathBadge({ url, query, prefix, suffix })
} catch (e) {
  if (e.prettyMessage === 'no result') {
    renderPlaceholderBadge('value unavailable')
  } else throw e
}

Prevention

When it happens

Trigger: Dynamic JSON badge (/badge/dynamic/json) where the url returns valid JSON but no element matches the query: wrong key names, data moved to a different path, empty arrays/objects in the response.

Common situations: Upstream API schema changes; querying $.items[0].version when items is empty; case-sensitive key typos; response envelope wrapped differently (e.g. data.result vs result).

Related errors


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