{"record":{"id":"392e2eaf8d096dde","repo":"microsoft/playwright","slug":"name-attribute-must-be-a-string-or-a-regular-exp","errorCode":null,"errorMessage":"\"name\" attribute must be a string or a regular expression","messagePattern":"\"name\" attribute must be a string or a regular expression","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/injected/src/roleSelectorEngine.ts","lineNumber":113,"sourceCode":"        // Level is a number, convert it from string.\n        if (typeof attr.value === 'string')\n          attr.value = +attr.value;\n        if (attr.op !== '=' || typeof attr.value !== 'number' || Number.isNaN(attr.value))\n          throw new Error(`\"level\" attribute must be compared to a number`);\n        options.level = attr.value;\n        break;\n      }\n      case 'disabled': {\n        validateSupportedValues(attr, [true, false]);\n        validateSupportedOp(attr, ['<truthy>', '=']);\n        options.disabled = attr.op === '<truthy>' ? true : attr.value;\n        break;\n      }\n      case 'name': {\n        if (attr.op === '<truthy>')\n          throw new Error(`\"name\" attribute must have a value`);\n        if (typeof attr.value !== 'string' && !(attr.value instanceof RegExp))\n          throw new Error(`\"name\" attribute must be a string or a regular expression`);\n        options.name = attr.value;\n        options.nameOp = attr.op;\n        options.nameExact = attr.caseSensitive;\n        break;\n      }\n      case 'description': {\n        if (attr.op === '<truthy>')\n          throw new Error(`\"description\" attribute must have a value`);\n        if (typeof attr.value !== 'string' && !(attr.value instanceof RegExp))\n          throw new Error(`\"description\" attribute must be a string or a regular expression`);\n        options.description = attr.value;\n        options.descriptionOp = attr.op;\n        options.descriptionExact = attr.caseSensitive;\n        break;\n      }\n      case 'include-hidden': {\n        validateSupportedValues(attr, [true, false]);\n        validateSupportedOp(attr, ['<truthy>', '=']);","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/injected/src/roleSelectorEngine.ts#L95-L131","documentation":"Error \"\"name\" attribute must be a string or a regular expression\" thrown in microsoft/playwright.","triggerScenarios":"Thrown at packages/injected/src/roleSelectorEngine.ts:113 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}