{"record":{"id":"7242baa2f385adde","repo":"nodejs/node","slug":"gencmn-udata-finish-failed-s-n","errorCode":null,"errorMessage":"gencmn: udata_finish() failed - %s\\n","messagePattern":"gencmn: udata_finish\\(\\) failed - (.+?)\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/icu-small/source/tools/toolutil/pkg_gencmn.cpp","lineNumber":306,"sourceCode":"            T_FileStream_close(file);\n            length=files[i].fileSize;\n\n            if (nread != files[i].fileSize) {\n              fprintf(stderr, \"gencmn: unable to read %s properly (got %ld/%ld byte%s)\\n\", files[i].pathname,  (long)nread, (long)files[i].fileSize, files[i].fileSize == 1 ? \"\" : \"s\");\n                exit(U_FILE_ACCESS_ERROR);\n            }\n        }\n\n        /* pad to 16-align the last file (cleaner, avoids growing .dat files in icuswap) */\n        length&=0xf;\n        if(length!=0) {\n            udata_writePadding(out, 16-length);\n        }\n\n        /* finish */\n        udata_finish(out, &errorCode);\n        if(U_FAILURE(errorCode)) {\n            fprintf(stderr, \"gencmn: udata_finish() failed - %s\\n\", u_errorName(errorCode));\n            exit(errorCode);\n        }\n    } else {\n        /* write a .c source file with the table of contents */\n        char *filename;\n        FileStream *out;\n\n        /* create the output filename */\n        filename=s=buffer;\n        uprv_strcpy(filename, destDir);\n        s=filename+uprv_strlen(filename);\n        if(s>filename && *(s-1)!=U_FILE_SEP_CHAR) {\n            *s++=U_FILE_SEP_CHAR;\n        }\n        uprv_strcpy(s, name);\n        if(*(type)!=0) {\n            s+=uprv_strlen(s);\n            *s++='_';","sourceCodeStart":288,"sourceCodeEnd":324,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/icu-small/source/tools/toolutil/pkg_gencmn.cpp#L288-L324","documentation":"After writing all data and padding, udata_finish(out, &errorCode) reported U_FAILURE. gencmn prints udata_finish() failed with u_errorName and exit(errorCode), indicating the output container could not be finalized/flushed.","triggerScenarios":"A write/flush error while finalizing the .dat header or closing the file: disk full at the very end, I/O error on the output device, or an internal udata accounting failure. The check is `if(U_FAILURE(errorCode))` immediately after udata_finish.","commonSituations":"Disk fills up during the write so the final flush/header rewrite fails; output on a network volume that drops at close; an interrupted build leaving a partial .dat.","solutions":["Free space on the output volume and re-run (this is usually the cause of a finish/close failure).","Run the build on a local disk instead of a network mount.","Remove the partial output .dat so gencmn starts fresh: `rm -f \"$DEST/$NAME.$TYPE\"`.","Check dmesg/system logs for I/O errors on the target device."],"exampleFix":"# before: output on a near-full network mount\ngencmn -d /mnt/nfs/out ...\n# after\ndf -h ./out && gencmn -d ./out ...   # local, enough free space","handlingStrategy":"validation","validationCode":"# check free space on the destination volume before running\ndf -k \"$DEST\" | awk 'NR==2 && $4 < 1048576 { exit 1 }' || { echo \"low disk on $DEST\" >&2; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure adequate free space (>= 2x expected .dat size) before building.","Build on local disk; network mounts can drop at close.","Check gencmn exit code and remove any partial .dat on failure.","Watch dmesg for I/O errors if this recurs."],"tags":["icu","gencmn","udata","build-tools","io-error"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}