{"record":{"id":"86dea97ad9a2b7c7","repo":"Yalantis/uCrop","slug":"cimg-appname-math-parser-cimg-s-s-s-w","errorCode":null,"errorMessage":"[\" cimg_appname \"_math_parser] CImg<%s>::%s: %s: Warp vector size (%lu values) and its specified geometry (%u,%u,%u,%u) (%lu values) do not match.","messagePattern":"\\[\" cimg_appname \"_math_parser\\] CImg<(.+?)>::(.+?): (.+?): Warp vector size \\(%lu values\\) and its specified geometry \\(%u,%u,%u,%u\\) \\(%lu values\\) do not match\\.","errorType":"exception","errorClass":"CImgArgumentException","httpStatus":null,"severity":"error","filePath":"ucrop/src/main/jni/CImg.h","lineNumber":24176,"sourceCode":"              arg3 = (unsigned int)mem[opcode[1]]; opcode[1] = arg3;\n              arg4 = (unsigned int)mem[opcode[2]]; opcode[2] = arg4;\n              arg5 = (unsigned int)mem[opcode[3]]; opcode[3] = arg5;\n              arg6 = (unsigned int)mem[opcode[4]]; opcode[4] = arg6;\n              if (arg3*arg4*arg5*arg6!=std::max(1U,p1)) {\n                _cimg_mp_strerr;\n                throw CImgArgumentException(\"[\" cimg_appname \"_math_parser] \"\n                                            \"CImg<%s>::%s: %s: Input vector size (%lu values) and its specified \"\n                                            \"geometry (%u,%u,%u,%u) (%lu values) do not match.\",\n                                            pixel_type(),_cimg_mp_calling_function,s_op,\n                                            std::max(p1,1U),arg3,arg4,arg5,arg6,(ulongT)arg3*arg4*arg5*arg6);\n              }\n              arg3 = (unsigned int)mem[opcode[6]]; opcode[6] = arg3;\n              arg4 = (unsigned int)mem[opcode[7]]; opcode[7] = arg4;\n              arg5 = (unsigned int)mem[opcode[8]]; opcode[8] = arg5;\n              arg6 = (unsigned int)mem[opcode[9]]; opcode[9] = arg6;\n              if (arg3*arg4*arg5*arg6!=std::max(1U,p2)) {\n                _cimg_mp_strerr;\n                throw CImgArgumentException(\"[\" cimg_appname \"_math_parser] \"\n                                            \"CImg<%s>::%s: %s: Warp vector size (%lu values) and its specified \"\n                                            \"geometry (%u,%u,%u,%u) (%lu values) do not match.\",\n                                            pixel_type(),_cimg_mp_calling_function,s_op,\n                                            std::max(p2,1U),arg3,arg4,arg5,arg6,(ulongT)arg3*arg4*arg5*arg6);\n              }\n              pos = vector(arg3*arg4*arg5*(unsigned int)opcode[4]);\n              opcode.resize(1,15,1,1,0,0,0,1);\n              opcode[0] = (ulongT)mp_warp;\n              opcode[1] = (ulongT)pos;\n              opcode.move_to(code);\n              return_comp = true;\n              _cimg_mp_return(pos);\n            }\n\n            if (!std::strncmp(ss,\"wave(\",5)) { // Wave function\n              _cimg_mp_op(\"Function 'wave()'\");\n              s1 = ss5; while (s1<se1 && (*s1!=',' || level[s1 - expr._data]!=clevel1)) ++s1;\n              arg1 = compile(ss5,s1,depth1,0,block_flags); // x","sourceCodeStart":24158,"sourceCodeEnd":24194,"githubUrl":"https://github.com/Yalantis/uCrop/blob/f788b534b48c144edf786c8cddbf0e029e637804/ucrop/src/main/jni/CImg.h#L24158-L24194","documentation":"Companion check of the same warp opcode: the warp vector's value count (max 1) must equal the product of its four geometry dims opcode[6..9]. When the warp coordinates vector and its declared (w,h,d,s) geometry disagree, the VM throws with both counts.","triggerScenarios":"Executing a warp expression where the warp-coordinate vector was built with a different size than the geometry stored in opcode slots 6-9, e.g. 8 values with dims (2,2,1,1)=4.","commonSituations":"Changing interpolation dimensions without regenerating the warp vector; reusing a warp vector computed for another image size; hand-editing dims in a serialized expression.","solutions":["Ensure width*height*depth*spectrum of the warp geometry equals the warp vector's actual value count (or 1 if empty).","Rebuild the warp vector with the correct number of coordinates for the target geometry.","Update the geometry arguments in the expression to match the warp vector you actually pass."],"exampleFix":"// before: warp vector has 8 values, dims say 4\n'warp(input,warpvec,2,2,1,1)'\n// after\n'warp(input,warpvec,8,1,1,1)'","handlingStrategy":"validation","validationCode":"if (w*h*d*s !== Math.max(1, warpVec.length)) throw new Error('Warp geometry ' + w*h*d*s + ' != size ' + Math.max(1, warpVec.length));","typeGuard":null,"tryCatchPattern":"try { img.eval(expr); } catch (e) { if (/Warp vector size .* do not match/.test(e.message)) { /* rebuild warp vector for the declared geometry */ } else throw e; }","preventionTips":["Rebuild warp vectors whenever target dimensions change.","Keep warp vector construction and geometry args in one builder function.","Cache warp vectors together with the dims they were built for."],"tags":["cimg","math-parser","geometry"],"backgroundTag":"tensor-shape-mismatch","analyzedSha":"f788b534b48c144edf786c8cddbf0e029e637804","analyzedAt":"2026-09-08T08:36:04.887Z","contentChangedAt":"2026-09-08T08:36:04.887Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}