{"record":{"id":"c6100ffa3878492f","repo":"python/cpython","slug":"error-when-writing-to-s","errorCode":null,"errorMessage":"error when writing to '%s'\n","messagePattern":"error when writing to '(.+?)'\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"Programs/_freeze_module.c","lineNumber":210,"sourceCode":"       which in turn should cause the EOL style match the C library's text mode */\n    FILE *outfile = fopen(outpath, \"w\");\n    if (outfile == NULL) {\n        fprintf(stderr, \"cannot open '%s' for writing\\n\", outpath);\n        return -1;\n    }\n\n    fprintf(outfile, \"%s\\n\", header);\n    char *arrayname = get_varname(name, \"_Py_M__\");\n    if (arrayname == NULL) {\n        fprintf(stderr, \"memory error: could not allocate varname\\n\");\n        fclose(outfile);\n        return -1;\n    }\n    write_code(outfile, marshalled, arrayname);\n    free(arrayname);\n\n    if (ferror(outfile)) {\n        fprintf(stderr, \"error when writing to '%s'\\n\", outpath);\n        fclose(outfile);\n        return -1;\n    }\n    fclose(outfile);\n    return 0;\n}\n\nint\nmain(int argc, char *argv[])\n{\n    const char *name, *inpath, *outpath;\n\n    _PyImport_FrozenBootstrap = no_modules;\n    _PyImport_FrozenStdlib = no_modules;\n    _PyImport_FrozenTest = no_modules;\n    PyImport_FrozenModules = NULL;\n    _PyImport_FrozenAliases = aliases;\n","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/python/cpython/blob/bc6749cc3b5ae4a5e88a6cc2d5b3bebbe354eae6/Programs/_freeze_module.c#L192-L228","documentation":"Build-time error from Programs/_freeze_module.c: after writing the frozen module's C source, ferror(outfile) reports a stream error — typically ENOSPC (disk full) or an I/O error on the output file. The file is closed and write_frozen() returns -1, failing the freeze step.","triggerScenarios":"The output filesystem fills up while write_code() emits the (large) marshalled-data array; I/O errors on the target device; network filesystems dropping mid-write.","commonSituations":"CI runners or VMs with small /tmp or workspace disks filling during a CPython build; building on NFS/SMB mounts that fail transiently.","solutions":["Free disk space (`df -h`) and rerun the build","Build on a filesystem with adequate free space; clean previous build dirs (`git clean -fdx` carefully)","If on a network mount, remount/reconnect and rerun"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"# shell: require free space before the freeze stage\n# [ \"$(df -Pk \"$OUT\" | awk 'NR==2{print $4}')\" -gt 1048576 ] || { echo 'need >1GB free'; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check df -h before large builds","Clean stale build directories between full builds","Avoid network mounts for build outputs when local disk is available"],"tags":["cpython","build","freeze-module","disk-full","io-error"],"backgroundTag":null,"analyzedSha":"bc6749cc3b5ae4a5e88a6cc2d5b3bebbe354eae6","analyzedAt":"2026-08-14T22:01:13.976Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}