Yalantis/uCrop · error · CImgArgumentException
%s(): Invalid sequence of filling values '%s'.
Error message
%s(): Invalid sequence of filling values '%s'.
What it means
When fill() cannot interpret the provided expression as a valid sequence of filling values (neither as an expression nor as a value list, and no specific parser error was captured), it throws CImgArgumentException naming the calling function and the offending expression string.
Source
Thrown at ucrop/src/main/jni/CImg.h:35185
}
mp.end();
if (result_end && mp.result_end) // Transfer result of the end() block if requested
result_end->assign(mp.result_end + (mp.result_end_dim?1:0),std::max(1U,mp.result_end_dim));
is_done = true;
} catch (CImgException& e) { CImg<charT>::string(e._message).move_to(is_error_expr); }
}
// Try to fill values according to a value sequence.
if (!is_done && mode&1) is_done = !_fill_from_values(expression,repeat_values);
if (!is_done) {
cimg::exception_mode(excmode);
if (is_error_expr) throw CImgArgumentException(_cimg_instance
"%s",
cimg_instance,is_error_expr._data);
else throw CImgArgumentException(_cimg_instance
"%s(): Invalid sequence of filling values '%s'.",
cimg_instance,calling_function,expression);
}
cimg::exception_mode(excmode);
cimg_abort_test;
return *this;
}
//! Fill sequentially pixel values according to a given expression \newinstance.
CImg<T> get_fill(const char *const expression, const bool repeat_values, const bool allow_formula=true,
CImgList<T> *const list_images=0) const {
return (+*this)._fill(expression,repeat_values,allow_formula?3:1,list_images,"fill",this,0);
}
//! Fill sequentially pixel values according to a value sequence, given as a string.
/**
\param values C-string describing a sequence of values.
\param repeat_values Tells if this sequence must be repeated when filling.View on GitHub (pinned to f788b534b4)
Solutions
- Fix the value sequence: use a comma-separated list of numeric values, e.g. fill("1,2,3")
- If you meant a math expression, ensure it is valid CImg expression syntax (variables x,y,z,c and operators)
- Validate the string (numeric-only / parseable) before calling fill(); reject empties
- Read the message: it prints calling_function and the literal expression to spot the bad token
Example fix
// before
img.fill("1; 2; abc"); // invalid sequence
// after
img.fill("1,2,3"); // valid comma-separated values Defensive patterns
Strategy: validation
Validate before calling
bool isNumericValueList(const std::string& s) { for (char c : s) if (!(isdigit((unsigned char)c) || c==',' || c=='.' || c=='-' || c=='+' || isspace((unsigned char)c))) return false; return !s.empty(); } Try / catch
try { img.fill(expr.c_str()); } catch (CImgArgumentException& e) { /* fall back to default fill values or report */ } Prevention
- Use comma-separated numeric values for value lists
- Avoid locale-dependent decimal separators (always '.')
- Validate fill strings before passing them to fill()
When it happens
Trigger: Calling fill("...") with a string that is neither a valid math expression nor a comma-separated sequence of values — e.g. fill("1,abc,3") or an empty/garbage string, with mode&1 path (_fill_from_values) having failed.
Common situations: Passing non-numeric text or wrong decimal separators (locale commas) in value lists; empty strings from failed config reads; values lists with wrong separators (spaces vs commas); typos mixing expression and value-list syntax.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- %s
- "[" cimg_appname "_math_parser] CImg<%s>: Function 'polygon(
- "[" cimg_appname "_math_parser] CImg<%s>: Function 'polygon(
- invert(): Specified lambda (%g) should be >=0.
- sort(): Invalid specified axis '%c' (should be { x | y | z |
AI-assisted analysis of Yalantis/uCrop@f788b534b4 (2026-09-08).
Data as JSON: /api/errors/67899f3c1d507d87.
Report an issue: GitHub.