sqlmapproject/sqlmap · error · SqlmapGenericException

error occurred while running postprocess function

Error message

error occurred while running postprocess function '%s' ('%s')

What it means

getPage teardown: a --postprocess function raised while transforming the (page, headers, code) triple after the response; the finally-block wrapper names the function and its exception so the user knows their hook, not the transport, failed.

Solutions

  1. Fix the exception inside the postprocess script
  2. Guard the script against unexpected response shapes
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at lib/request/connect.py:1073 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sqlmapproject/sqlmap@0a35b20e39 (2026-08-26). Data as JSON: /api/errors/f4e9ec276bd0e3fd. Report an issue: GitHub.

Appendix: source

Thrown at lib/request/connect.py:1073

                    warnMsg += "(s)"
                    logger.critical(warnMsg)
                else:
                    logger.debug(warnMsg)
                return Connect._retryProxy(**kwargs)
            elif kb.testMode or kb.multiThreadMode:
                logger.critical(warnMsg)
                return None, None, None
            else:
                raise SqlmapConnectionException(warnMsg)

        finally:
            for function in kb.postprocessFunctions:
                try:
                    page, responseHeaders, code = function(page, responseHeaders, code)
                except Exception as ex:
                    errMsg = "error occurred while running postprocess "
                    errMsg += "function '%s' ('%s')" % (function.__name__, getSafeExString(ex))
                    raise SqlmapGenericException(errMsg)

            if isinstance(page, six.binary_type):
                if HTTP_HEADER.CONTENT_TYPE in (responseHeaders or {}) and not re.search(TEXT_CONTENT_TYPE_REGEX, responseHeaders[HTTP_HEADER.CONTENT_TYPE]):
                    page = six.text_type(page, errors="ignore")
                else:
                    page = getUnicode(page)

            for _ in (getattr(conn, "redcode", None), code):
                if _ is not None and _ in conf.abortCode:
                    errMsg = "aborting due to detected HTTP code '%d'" % _
                    singleTimeLogMessage(errMsg, logging.CRITICAL)
                    raise SystemExit

            # decode a gRPC-Web response to readable text so the oracle/error/inband paths see the
            # message fields + trailer (grpc-message) instead of an opaque base64 blob. Headers are
            # passed so a trailers-only error (empty body, grpc-status/message in headers) is still surfaced
            if kb.postHint == POST_HINT.GRPC_WEB:
                page = grpcDecodeResponse(page, responseHeaders)

View on GitHub (pinned to 0a35b20e39)