Yalantis/uCrop · error · CImgArgumentException
[" cimg_appname "_math_parser] CImg<%s>::%s: %s: Type of thi
Error message
[" cimg_appname "_math_parser] CImg<%s>::%s: %s: Type of third argument ('%s') do not match with fourth argument 'nb_colsD=%u', in expression '%s'. What it means
Companion check to the source one: the third argument (destination) must have size nb_colsD * nb_rowsD. When wD*hD != p2, the destination column count does not divide the destination vector size and the parser throws.
Source
Thrown at ucrop/src/main/jni/CImg.h:22647
p2 = size(arg3);
const unsigned int
wS = (unsigned int)mem[arg2],
wD = (unsigned int)mem[arg4],
hS = p1/wS,
hD = p2/wD;
if (wS*hS!=p1) {
_cimg_mp_strerr;
throw CImgArgumentException("[" cimg_appname "_math_parser] "
"CImg<%s>::%s: %s: Type of first argument ('%s') "
"do not match with second argument 'nb_colsS=%u', "
"in expression '%s'.",
pixel_type(),_cimg_mp_calling_function,s_op,
s_type(arg1)._data,wS,s0);
}
if (wD*hD!=p2) {
_cimg_mp_strerr;
throw CImgArgumentException("[" cimg_appname "_math_parser] "
"CImg<%s>::%s: %s: Type of third argument ('%s') "
"do not match with fourth argument 'nb_colsD=%u', "
"in expression '%s'.",
pixel_type(),_cimg_mp_calling_function,s_op,
s_type(arg3)._data,wD,s0);
}
if (hS!=hD) {
_cimg_mp_strerr;
throw CImgArgumentException("[" cimg_appname "_math_parser] "
"CImg<%s>::%s: %s: Type of first argument ('%s') "
"do not match with third argument ('%s'), "
"in expression '%s'.",
pixel_type(),_cimg_mp_calling_function,s_op,
s_type(arg1)._data,s_type(arg3)._data,s0);
}
pos = vector(wS*wD);
CImg<ulongT>::vector((ulongT)mp_mproj,pos,arg1,wS,hS,arg3,wD,arg5,arg6,p3).move_to(code);
return_comp = true;View on GitHub (pinned to f788b534b4)
Solutions
- Verify size(destination) % nb_colsD == 0; fix nb_colsD or resize destination
- Print size of the destination vector before the op
- Allocate the destination with the exact rows*cols expected by the op
- Ensure the destination is not shared with an unrelated result
Example fix
// before: destination has 20 values, nb_colsD=3 dst = vector(20); op(S,dst,3) // after dst = vector(20); op(S,dst,4) // 20 = 5*4
Defensive patterns
Strategy: validation
Validate before calling
size(dst) % nb_colsD == 0 || error "destination size not divisible by nb_colsD"
Try / catch
try { run(expr) } catch (CImgArgumentException &e) { log(e.what()); } Prevention
- Allocate destinations with exact rows*cols
- Recheck nb_colsD after refactors
- Avoid reusing destination buffers across ops
When it happens
Trigger: Same two-matrix op as error 122, but the mismatch is in the destination operand: nb_colsD does not divide size(arg3).
Common situations: Destination buffer allocated with a different width than declared, wrong nb_colsD constant, or reusing a destination vector from another computation.
Understand the failure class
Background: Tensor shape mismatch errors ("must have shape", "expected shape ... got ..."): when tensor dimensions disagree with what an op or layer was told to expect — this error's family across 6 libraries.
Related errors
- [" cimg_appname "_math_parser] CImg<%s>::%s: %s: Type of sec
- [" cimg_appname "_math_parser] CImg<%s>::%s: %s: Type of fir
- [" cimg_appname "_math_parser] CImg<%s>::%s: %s: Type of fir
- operator*(): Invalid multiplication of instance by specified
- [cimg_appname_math_parser] CImg<%s>::%s: %s: Too much specif
AI-assisted analysis of Yalantis/uCrop@f788b534b4 (2026-09-08).
Data as JSON: /api/errors/f25f584d68b101b3.
Report an issue: GitHub.