{"record":{"id":"54931ce1bbb43942","repo":"sqlmapproject/sqlmap","slug":"not-valid-json-nor-yaml-s","errorCode":null,"errorMessage":"not valid JSON nor YAML (%s)","messagePattern":"not valid JSON nor YAML \\((.+?)\\)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"lib/parse/openapi.py","lineNumber":41,"sourceCode":"# Best-effort extraction of concrete request targets from an OpenAPI (v3) / Swagger (v2) document. The\n# document is treated as a request generator, NOT a contract to validate: for every operation a single\n# concrete request is synthesized (base URL + filled path + example query/body from the schema) and any\n# operation that cannot be built is skipped with a warning, so a loose/incomplete spec degrades gracefully.\n\nMAX_REF_DEPTH = 25\n\ndef _loadSpec(content):\n    try:\n        return json.loads(content)\n    except ValueError:\n        if yaml is None:\n            errMsg = \"the provided OpenAPI/Swagger specification is not JSON and the optional \"\n            errMsg += \"'pyyaml' module (needed for YAML specifications) is not available\"\n            raise ValueError(errMsg)\n        try:\n            return yaml.safe_load(content)\n        except Exception as ex:\n            raise ValueError(\"not valid JSON nor YAML (%s)\" % getSafeExString(ex))\n\ndef _resolve(spec, node, seen=None, depth=0):\n    seen = seen or set()\n    if isinstance(node, dict) and \"$ref\" in node:\n        ref = node[\"$ref\"]\n        if not isinstance(ref, six.string_types):         # malformed '$ref' (non-string) -> treat as no ref\n            return {}\n        if ref in seen or depth > MAX_REF_DEPTH:\n            return {}\n        if not ref.startswith(\"#/\"):\n            logger.warning(\"skipping external OpenAPI $ref '%s'\" % ref)\n            return {}\n        seen = seen | set([ref])\n        current = spec\n        for part in ref[2:].split('/'):\n            part = part.replace(\"~1\", \"/\").replace(\"~0\", \"~\")\n            if not isinstance(current, dict) or part not in current:\n                logger.warning(\"skipping dangling OpenAPI $ref '%s'\" % ref)","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/sqlmapproject/sqlmap/blob/0a35b20e3953d341be6c7ac75ccb0b3362540c8d/lib/parse/openapi.py#L23-L59","documentation":"Error \"not valid JSON nor YAML (%s)\" thrown in sqlmapproject/sqlmap.","triggerScenarios":"Thrown at lib/parse/openapi.py:41 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"}