{"record":{"id":"f7aea6c660633f92","repo":"Yalantis/uCrop","slug":"cimglist-s-get-unserialize-unsupported-pixel","errorCode":null,"errorMessage":"CImgList<%s>::get_unserialize(): Unsupported pixel type '%s' defined in serialized buffer.","messagePattern":"CImgList<(.+?)>::get_unserialize\\(\\): Unsupported pixel type '(.+?)' defined in serialized buffer\\.","errorType":"exception","errorClass":"CImgArgumentException","httpStatus":null,"severity":"error","filePath":"ucrop/src/main/jni/CImg.h","lineNumber":68882,"sourceCode":"        throw CImgArgumentException(\"CImgList<%s>::get_unserialize(): CImg header not found in serialized buffer.\",\n                                    pixel_type());\n      if (!cimg::strncasecmp(\"little\",str_endian,6)) endian = false;\n      else if (!cimg::strncasecmp(\"big\",str_endian,3)) endian = true;\n      res.assign(N);\n      _cimg_unserialize_case(\"bool\",0,0,cimg_uint8);\n      _cimg_unserialize_case(\"uint8\",\"unsigned_char\",\"uchar\",cimg_uint8);\n      _cimg_unserialize_case(\"int8\",0,0,cimg_int8);\n      _cimg_unserialize_case(\"char\",0,0,char);\n      _cimg_unserialize_case(\"uint16\",\"unsigned_short\",\"ushort\",cimg_uint16);\n      _cimg_unserialize_case(\"int16\",\"short\",0,cimg_int16);\n      _cimg_unserialize_case(\"uint32\",\"unsigned_int\",\"uint\",cimg_uint32);\n      _cimg_unserialize_case(\"int32\",\"int\",0,cimg_int32);\n      _cimg_unserialize_case(\"uint64\",\"unsigned_int64\",0,cimg_uint64);\n      _cimg_unserialize_case(\"int64\",0,0,cimg_int64);\n      _cimg_unserialize_case(\"float32\",\"float\",0,cimg_float32);\n      _cimg_unserialize_case(\"float64\",\"double\",0,cimg_float64);\n      if (!loaded)\n        throw CImgArgumentException(\"CImgList<%s>::get_unserialize(): Unsupported pixel type '%s' defined \"\n                                    \"in serialized buffer.\",\n                                    pixel_type(),str_pixeltype._data);\n      return res;\n    }\n\n    //@}\n    //----------------------------------\n    //\n    //! \\name Others\n    //@{\n    //----------------------------------\n\n    //! Return a CImg pre-defined font with requested height.\n    /**\n       \\param font_height Height of the desired font (exact match for 13,23,53,103).\n       \\param is_variable_width Decide if the font has a variable (\\c true) or fixed (\\c false) width.\n    **/\n    static const CImgList<ucharT>& font(const unsigned int requested_height, const bool is_variable_width=true) {","sourceCodeStart":68864,"sourceCodeEnd":68900,"githubUrl":"https://github.com/Yalantis/uCrop/blob/f788b534b48c144edf786c8cddbf0e029e637804/ucrop/src/main/jni/CImg.h#L68864-L68900","documentation":"After exhaustively checking every known pixel-type keyword (bool, uint8, int8, uint16, int16, uint32, int32, uint64, int64, float32, float64), CImgList::get_unserialize() found no matching _cimg_unserialize_case, meaning the pixel type string in the serialized header is not one this build knows. CImg throws CImgArgumentException naming the offending type string.","triggerScenarios":"Unserializing a buffer whose header declares a pixel type string that is unknown or misspelled (e.g. written by a custom fork, a newer CImg version, or a hand-edited header), leaving the 'loaded' flag false.","commonSituations":"Producer used a CImg variant/fork with extra pixel types; header line manually edited or corrupted; passing a non-CImg file whose second token happens to parse as a count but not as a valid pixel type.","solutions":["Regenerate the serialized data using a standard CImg pixel type (uint8/float32/etc.).","Use matching CImg versions on producer and consumer.","Inspect the header line and correct an obviously corrupted pixel-type token.","Convert the data to a standard pixel type before serializing on the producer side."],"exampleFix":"// before (custom type in header)\n// '3 half 0' -> unsupported\n// after: re-save with a standard type\nCImgList<float> imgs; // cast source data to float32 and re-save\nimgs.save(\"data.cimg\");    // header now declares 'float32'","handlingStrategy":"validation","validationCode":"// Check the pixel-type token in the header before unserializing\nstd::istringstream hdr(headerLine); // e.g. '3 float32 0'\nunsigned N; std::string ptype;\nhdr >> N >> ptype;\nstatic const char* known[] = {\"bool\",\"uint8\",\"int8\",\"uint16\",\"int16\",\"uint32\",\"int32\",\"uint64\",\"int64\",\"float32\",\"float64\"};\nbool ok = false;\nfor (const char* k : known) if (ptype == k) { ok = true; break; }\nif (!ok) throw std::runtime_error(\"unsupported pixel type: \" + ptype);","typeGuard":null,"tryCatchPattern":"try {\n  imgs.unserialize(raw);\n} catch (CImgArgumentException& e) {\n  cimg::warn(\"unsupported pixel type in buffer: %s\", e.what());\n  // re-request data serialized with a standard pixel type\n}","preventionTips":["Serialize only with standard CImg pixel types.","Keep CImg versions consistent between producer and consumer.","Never hand-edit .cimg headers."],"tags":["serialization","pixel-type","parsing","native"],"backgroundTag":"unsupported-dtype","analyzedSha":"f788b534b48c144edf786c8cddbf0e029e637804","analyzedAt":"2026-09-08T08:36:04.887Z","contentChangedAt":"2026-09-08T08:36:04.887Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}