{"record":{"id":"e1c22b327bba7029","repo":"nodejs/node","slug":"setting-user-failed-for-s-s-n","errorCode":null,"errorMessage":"setting user failed for [%s]: %s\\n","messagePattern":"setting user failed for \\[(.+?)\\]: (.+?)\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"deps/brotli/c/tools/brotli.c","lineNumber":877,"sourceCode":"    return;\n  }\n  if (stat(input_path, &statbuf) != 0) {\n    return;\n  }\n  res = CopyTimeStat(&statbuf, output_path);\n  res = chmod(output_path, statbuf.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO));\n  if (res != 0) {\n    fprintf(stderr, \"setting access bits failed for [%s]: %s\\n\",\n            PrintablePath(output_path), strerror(errno));\n  }\n  res = chown(output_path, (uid_t)-1, statbuf.st_gid);\n  if (res != 0) {\n    fprintf(stderr, \"setting group failed for [%s]: %s\\n\",\n            PrintablePath(output_path), strerror(errno));\n  }\n  res = chown(output_path, statbuf.st_uid, (gid_t)-1);\n  if (res != 0) {\n    fprintf(stderr, \"setting user failed for [%s]: %s\\n\",\n            PrintablePath(output_path), strerror(errno));\n  }\n}\n\n/* Result ownership is passed to caller.\n   |*dictionary_size| is set to resulting buffer size. */\nstatic BROTLI_BOOL ReadDictionary(Context* context, Command command) {\n  static const int kMaxDictionarySize =\n      BROTLI_MAX_DISTANCE - BROTLI_MAX_BACKWARD_LIMIT(24);\n  FILE* f;\n  int64_t file_size_64;\n  uint8_t* buffer;\n  size_t bytes_read;\n\n  if (context->dictionary_path == NULL) return BROTLI_TRUE;\n  f = fopen(context->dictionary_path, \"rb\");\n  if (f == NULL) {\n    fprintf(stderr, \"failed to open dictionary file [%s]: %s\\n\",","sourceCodeStart":859,"sourceCodeEnd":895,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/brotli/c/tools/brotli.c#L859-L895","documentation":"During `CopyStat`, `chown()` failed when trying to set the owner (user ID) of the output file to match the input (gid left at -1, so only the owner changes). Non-fatal warning; the data conversion already completed.","triggerScenarios":"The invoking user is not root and not the current owner of the file (EPERM on most Unix systems — only root or the file owner can change the owner, and even the owner can only change to themselves on Linux); NFS root-squash; output deleted before chown.","commonSituations":"Running brotli as a non-root service account and trying to preserve ownership from files owned by root or another user; CI pipelines running as a generic user.","solutions":["Run as root if preserving owner is a hard requirement.","Use `--no-copy-stat` to suppress the ownership copy attempt.","Accept the warning when ownership preservation is not needed."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"#include <unistd.h>\n#include <stdbool.h>\n\nbool can_set_owner(uid_t target_uid) {\n    if (geteuid() == 0) return true; // root\n    // Non-root can only chown to themselves (and on Linux, only root can truly change owner)\n    return geteuid() == target_uid;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run as root only if owner preservation is a hard requirement.","Use `--no-copy-stat` to skip the ownership copy attempt entirely.","Treat the warning as non-fatal; the compressed/decompressed data is valid."],"tags":["filesystem","metadata","permissions","brotli"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}