sqlmapproject/sqlmap · error · RuntimeError
no working length function found
Error message
no working length function found
What it means
Error "no working length function found" thrown in sqlmapproject/sqlmap.
Source
Thrown at extra/esperanto/discovery.py:280
# so length stays in the same unit as the char-indexed substring
for prefer_chars in (True, False):
for name, tmpl in _LENGTH:
f = lambda s: tmpl.format(expr=s)
if not (self._ask("%s=1" % f("'A'")) and self._ask("%s=2" % f("'AB'"))):
continue
try:
unit = self._lengthUnit(f)
except OracleUndecided:
unit = "unknown"
if prefer_chars and unit != "characters":
continue
trailing = self._ask("%s=2" % f("'A '")) # preserves trailing space?
empty_null = not self._ask("(%s) IS NOT NULL" % f("''")) # LENGTH('') errors/NULL?
self.dialect.length = Cap(name, tmpl, unit=unit, trailing=trailing,
empty_is_null=empty_null)
return name
self.dialect.length = None
raise RuntimeError("no working length function found")
def _lengthUnit(self, f):
# ASCII-only: measure the length of a multibyte char built from its code.
# 1 => character-counting, >=2 => byte-counting. no raw non-ASCII on the wire.
cf = self._codeCharTmpl()
if not cf:
return "unknown"
mb = cf.format(code=0x20AC)
if self._ask("%s=1" % f(mb)):
return "characters"
if self._ask("%s>=2" % f(mb)):
return "bytes"
return "unknown"
def _fixupLength(self):
# a length fn that trims trailing spaces (SQL Server/Sybase LEN) truncates
# any value ending in spaces; rebuild it as LEN(x||'.')-1 with the concat.
L = self.dialect.lengthView on GitHub (pinned to 0a35b20e39)
When it happens
Trigger: Thrown at extra/esperanto/discovery.py:280 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/45264b475b207433.
Report an issue: GitHub.