{"record":{"id":"c187b678c92e75e8","repo":"sqlmapproject/sqlmap","slug":"unable-to-parse-the-openapi-swagger-specification","errorCode":null,"errorMessage":"unable to parse the OpenAPI/Swagger specification ('%s')","messagePattern":"unable to parse the OpenAPI/Swagger specification \\('(.+?)'\\)","errorType":"exception","errorClass":"SqlmapSyntaxException","httpStatus":null,"severity":"error","filePath":"lib/core/option.py","lineNumber":539,"sourceCode":"            origin = match.group(1) if match else None\n    else:\n        conf.openApiFile = safeExpandUser(conf.openApiFile)\n        checkFile(conf.openApiFile)\n        infoMsg = \"parsing OpenAPI/Swagger specification from '%s'\" % conf.openApiFile\n        logger.info(infoMsg)\n        with openFile(conf.openApiFile) as f:\n            content = f.read()\n\n    tags = [_.strip() for _ in re.split(PARAMETER_SPLITTING_REGEX, conf.openApiTags) if _.strip()] if conf.openApiTags else None\n    if tags:\n        infoMsg = \"restricting extraction to OpenAPI/Swagger operations tagged: %s\" % \", \".join(tags)\n        logger.info(infoMsg)\n\n    try:\n        targets = openApiTargets(content, origin, tags)\n    except ValueError as ex:\n        errMsg = \"unable to parse the OpenAPI/Swagger specification ('%s')\" % getSafeExString(ex)\n        raise SqlmapSyntaxException(errMsg)\n\n    if re.search(r\"(?i)securitySchemes|securityDefinitions\", content) and not any((conf.authType, conf.authCred, conf.authFile)) and not any((_[0] or \"\").lower() == HTTP_HEADER.AUTHORIZATION.lower() for _ in (conf.httpHeaders or [])):\n        warnMsg = \"the OpenAPI/Swagger specification declares authentication (security schemes) but no credentials were provided. \"\n        warnMsg += \"If the API requires authentication, requests are likely to be rejected. Provide credentials with \"\n        warnMsg += \"'--auth-type'/'--auth-cred' or a header (e.g. --headers=\\\"Authorization: Bearer ...\\\")\"\n        logger.warning(warnMsg)\n\n    before = len(kb.targets)                               # openapi carries per-target bodies -> no conf.data fallback\n    mutating = 0\n    for url, method, data, headers in targets:\n        if conf.scope and not re.search(conf.scope, url, re.I):\n            continue\n        if method not in (\"GET\", \"HEAD\", \"OPTIONS\"):\n            mutating += 1\n        kb.targets.add((url, method, data, conf.cookie, tuple(headers) if headers else None))\n\n    added = len(kb.targets) - before\n    if added:","sourceCodeStart":521,"sourceCodeEnd":557,"githubUrl":"https://github.com/sqlmapproject/sqlmap/blob/0a35b20e3953d341be6c7ac75ccb0b3362540c8d/lib/core/option.py#L521-L557","documentation":"Error \"unable to parse the OpenAPI/Swagger specification ('%s')\" thrown in sqlmapproject/sqlmap.","triggerScenarios":"Thrown at lib/core/option.py:539 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":"0a35b20e3953d341be6c7ac75ccb0b3362540c8d","analyzedAt":"2026-08-26T23:02:52.002Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}