{"record":{"id":"bc092ece4b44d334","repo":"badges/shields","slug":"invalid-api-key","errorCode":null,"errorMessage":"invalid api key","messagePattern":"invalid api key","errorType":"validation","errorClass":"InvalidParameter","httpStatus":null,"severity":"error","filePath":"services/pingpong/pingpong-base.js","lineNumber":17,"sourceCode":"import { BaseJsonService, InvalidParameter } from '../index.js'\n\nexport const description = `\n[PingPong](https://pingpong.one/) is a status page and monitoring service.\n\nTo see more details about this badge and obtain your api key, visit\n[https://my.pingpong.one/integrations/badge-uptime/](https://my.pingpong.one/integrations/badge-uptime/)\n`\n\nexport const baseUrl = 'https://api.pingpong.one/widget/shields'\n\nexport class BasePingPongService extends BaseJsonService {\n  static category = 'monitoring'\n\n  static validateApiKey({ apiKey }) {\n    if (!apiKey.startsWith('sp_')) {\n      throw new InvalidParameter({\n        prettyMessage: 'invalid api key',\n      })\n    }\n  }\n}\n","sourceCodeStart":1,"sourceCodeEnd":23,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/pingpong/pingpong-base.js#L1-L23","documentation":"This InvalidParameter error is raised by BasePingPongService.validateApiKey when the configured PingPong API key does not start with the required 'sp_' prefix. PingPong (pingpong-go) issues keys of the form sp_..., so any other string is rejected before any network request is made.","triggerScenarios":"Configuring a PingPong badge/service with an apiKey config value that lacks the sp_ prefix — e.g. passing a raw UUID token, a different vendor's key, or a truncated key.","commonSituations":"Copying the wrong credential type into config/environment; migrating config from another status-page provider; string truncation when pasting the key into env files.","solutions":["Log into your PingPong dashboard and copy the full API key, which must begin with sp_","Set the key correctly in the service config (e.g. privateApiKey or via the configured env var)","Verify no shell quoting/escaping stripped characters from the key","Confirm you are using a PingPong (pingpong-go) key, not a key from another monitoring provider"],"exampleFix":"// before\napiKey: 'a1b2c3d4e5f6'\n// after\napiKey: 'sp_a1b2c3d4e5f6...'","handlingStrategy":"validation","validationCode":"if (typeof apiKey !== 'string' || !apiKey.startsWith('sp_')) throw new Error('PingPong API key must be a string starting with sp_')","typeGuard":"function isValidPingPongKey(key) {\n  return typeof key === 'string' && key.startsWith('sp_') && key.length > 3\n}","tryCatchPattern":"try {\n  BasePingPongService.validateApiKey({ apiKey: config.apiKey })\n} catch (e) {\n  if (e instanceof InvalidParameter) throw new Error('Config error: PINGPONG_API_KEY must start with sp_')\n  throw e\n}","preventionTips":["Store the full sp_-prefixed key in env/config and validate at startup","Do not truncate or reformat the key when copying from the PingPong dashboard","Add a startup assertion that the key matches /^sp_[A-Za-z0-9]+$/","Keep PingPong keys separate from other providers' credentials"],"tags":["pingpong","api-key","validation","bad-request"],"backgroundTag":"invalid-api-key","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}