{"record":{"id":"82230dfa538d6beb","repo":"remoteintech/remote-jobs","slug":"invalid-region-data-region-must-be-one-of","errorCode":null,"errorMessage":"Invalid `region`: \"${data.region}\". Must be one of: ${VALID_REGIONS.join(\", \")}","messagePattern":"Invalid `region`: \"(.+?)\"\\. Must be one of: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":".github/scripts/validate-companies.js","lineNumber":117,"sourceCode":"  const data = parseFrontmatter(content);\n  if (!data) {\n    errors.push(\n      \"Missing YAML frontmatter. The file must start with `---` followed by YAML fields and a closing `---`.\"\n    );\n    return { errors, warnings };\n  }\n\n  // Check required fields\n  for (const field of REQUIRED_FIELDS) {\n    if (!data[field] || (typeof data[field] === \"string\" && !data[field].trim())) {\n      errors.push(`Missing required field: \\`${field}\\``);\n    }\n  }\n\n  // Validate enum values (only if field exists)\n  if (data.region && !VALID_REGIONS.includes(data.region)) {\n    errors.push(\n      `Invalid \\`region\\`: \"${data.region}\". Must be one of: ${VALID_REGIONS.join(\", \")}`\n    );\n  }\n\n  if (data.remote_policy && !VALID_REMOTE_POLICIES.includes(data.remote_policy)) {\n    errors.push(\n      `Invalid \\`remote_policy\\`: \"${data.remote_policy}\". Must be one of: ${VALID_REMOTE_POLICIES.join(\", \")}`\n    );\n  }\n\n  if (data.company_size && !VALID_COMPANY_SIZES.includes(data.company_size)) {\n    errors.push(\n      `Invalid \\`company_size\\`: \"${data.company_size}\". Must be one of: ${VALID_COMPANY_SIZES.join(\", \")}`\n    );\n  }\n\n  // Validate technologies array\n  if (data.technologies && Array.isArray(data.technologies)) {\n    for (const tech of data.technologies) {","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/remoteintech/remote-jobs/blob/b1dd8deb1945e5ff58f9e9c35e318f53c8871930/.github/scripts/validate-companies.js#L99-L135","documentation":"Enum check at lines 115-119. If data.region is truthy but not in VALID_REGIONS (Object.keys of labels().region from src/_data/labels.js), the value is rejected. The allowed list is sourced from the same labels.js the site renders from, so adding a region there automatically widens validation.","triggerScenarios":"Contributor invents a value like 'global', 'us', or 'ww' instead of an allowed key such as 'worldwide' or 'americas'; casing error ('Worldwide'); a region key was renamed in labels.js but the profile wasn't updated.","commonSituations":"Copy-paste from a different directory using a different convention; outdated third-party example; rebrand/refactor of region taxonomy in labels.js.","solutions":["Read the allowed list straight from the error message (it joins VALID_REGIONS).","Set `region:` to one of those exact keys (case-sensitive).","If a genuinely new region is needed, add it to labels().region in src/_data/labels.js first so validation widens with the site."],"exampleFix":"// before\nregion: global\n// after\nregion: worldwide","handlingStrategy":"validation","validationCode":"import labels from '../../src/_data/labels.js';\nconst VALID_REGIONS = Object.keys(labels().region);\nfunction validRegion(value) {\n  return VALID_REGIONS.includes(value);\n}","typeGuard":"function isRegion(value) {\n  return typeof value === 'string' && Object.keys(labels().region).includes(value);\n}","tryCatchPattern":null,"preventionTips":["Always copy the region key from labels.js rather than transcribing from memory.","When renaming a region in labels.js, run the validator across all profiles and migrate them in the same PR.","Treat region as case-sensitive kebab-case."],"tags":["enum","region","frontmatter","labels"],"backgroundTag":null,"analyzedSha":"b1dd8deb1945e5ff58f9e9c35e318f53c8871930","analyzedAt":"2026-08-13T04:09:00.804Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}