{"record":{"id":"7d3da0c15f6b6e95","repo":"sqlmapproject/sqlmap","slug":"missing-function-postprocess-page-headers-none","errorCode":null,"errorMessage":"missing function 'postprocess(page, headers=None, code=None)' in postprocess script '%s'","messagePattern":"missing function 'postprocess\\(page, headers=None, code=None\\)' in postprocess script '(.+?)'","errorType":"exception","errorClass":"SqlmapGenericException","httpStatus":null,"severity":"error","filePath":"lib/core/option.py","lineNumber":1113,"sourceCode":"            try:\n                getattr(importlib, \"invalidate_caches\", lambda: None)()  # Note: py3.3+ only; a script just written into an already-scanned dir is invisible to a cached FileFinder (Windows coarse mtime)\n                module = __import__(safeFilepathEncode(filename[:-3]))\n            except Exception as ex:\n                raise SqlmapSyntaxException(\"cannot import postprocess module '%s' (%s)\" % (getUnicode(filename[:-3]), getSafeExString(ex)))\n\n            for name, function in inspect.getmembers(module, inspect.isfunction):\n                if name == \"postprocess\" and inspect.getargspec(function).args and all(_ in inspect.getargspec(function).args for _ in (\"page\", \"headers\", \"code\")):\n                    found = True\n\n                    kb.postprocessFunctions.append(function)\n                    function.__name__ = module.__name__\n\n                    break\n\n            if not found:\n                errMsg = \"missing function 'postprocess(page, headers=None, code=None)' \"\n                errMsg += \"in postprocess script '%s'\" % script\n                raise SqlmapGenericException(errMsg)\n            else:\n                try:\n                    _, _, _ = function(\"\", {}, None)\n                except:\n                    handle, filename = tempfile.mkstemp(prefix=MKSTEMP_PREFIX.PREPROCESS, suffix=\".py\")\n                    os.close(handle)\n\n                    openFile(filename, \"w+\").write(\"#!/usr/bin/env\\n\\ndef postprocess(page, headers=None, code=None):\\n    return page, headers, code\\n\")\n                    openFile(os.path.join(os.path.dirname(filename), \"__init__.py\"), \"w+\").write(\"pass\")\n\n                    errMsg = \"function 'postprocess(page, headers=None, code=None)' \"\n                    errMsg += \"in postprocess script '%s' \" % script\n                    errMsg += \"should return a tuple '(page, headers, code)' \"\n                    errMsg += \"(Note: find template script at '%s')\" % filename\n                    raise SqlmapGenericException(errMsg)\n\ndef _setThreads():\n    if not isinstance(conf.threads, int) or conf.threads <= 0:","sourceCodeStart":1095,"sourceCodeEnd":1131,"githubUrl":"https://github.com/sqlmapproject/sqlmap/blob/0a35b20e3953d341be6c7ac75ccb0b3362540c8d/lib/core/option.py#L1095-L1131","documentation":"After importing the postprocess module, sqlmap scans its functions for one named 'postprocess' accepting the signature postprocess(page, headers=None, code=None) that will be applied to each HTTP response. If inspect finds no such function, this SqlmapGenericException is raised — a contract check that the script exports the required response-processing hook.","triggerScenarios":"Thrown at lib/core/option.py:1113 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Define a top-level `def postprocess(page, headers=None, code=None):` in the script with the exact name and signature.","Ensure the function is module-level (not nested, not a method) so inspect.getmembers can discover it.","Use the default-argument form shown in the message; extra required parameters will fail the signature match.","Start from sqlmap's bundled template postprocess script and adapt it."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0a35b20e3953d341be6c7ac75ccb0b3362540c8d","analyzedAt":"2026-08-26T23:02:52.002Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}