{"record":{"id":"4c405d1cb6bdd90f","repo":"nodejs/node","slug":"s-unable-to-locate-pkgdata-inc-unable-to-parse","errorCode":null,"errorMessage":"%s: Unable to locate pkgdata.inc. Unable to parse the results of '%s'. Check paths or use the -O option to specify the path to pkgdata.inc.\\n","messagePattern":"(.+?): Unable to locate pkgdata\\.inc\\. Unable to parse the results of '(.+?)'\\. Check paths or use the -O option to specify the path to pkgdata\\.inc\\.\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/icu-small/source/tools/pkgdata/pkgdata.cpp","lineNumber":2201,"sourceCode":"    if (!getPkgDataPath(pkgconfigCmd, verbose, buf, UPRV_LENGTHOF(buf))) {\n        if (!getPkgDataPath(icuconfigCmd, verbose, buf, UPRV_LENGTHOF(buf))) {\n            fprintf(stderr, \"%s: icu-config not found. Fix PATH or specify -O option\\n\", progname);\n            return -1;\n        }\n\n        pkgconfigIsValid = false;\n    }\n\n    for (int32_t length = strlen(buf) - 1; length >= 0; length--) {\n        if (buf[length] == '\\n' || buf[length] == ' ') {\n            buf[length] = 0;\n        } else {\n            break;\n        }\n    }\n\n    if (!*buf) {\n        fprintf(stderr, \"%s: Unable to locate pkgdata.inc. Unable to parse the results of '%s'. Check paths or use the -O option to specify the path to pkgdata.inc.\\n\", progname, pkgconfigIsValid ? pkgconfigCmd : icuconfigCmd);\n        return -1;\n    }\n\n    if (pkgconfigIsValid) {\n        uprv_strcat(buf, U_FILE_SEP_STRING);\n        uprv_strcat(buf, pkgdata);\n    }\n\n    buf[strlen(buf)] = 0;\n\n    option->value = buf;\n    option->doesOccur = true;\n\n    return 0;\n#else\n    return -1;\n#endif\n}","sourceCodeStart":2183,"sourceCodeEnd":2219,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/icu-small/source/tools/pkgdata/pkgdata.cpp#L2183-L2219","documentation":"pkg_getPkgDataPath successfully ran a probe command but the captured buffer is empty after stripping trailing newlines/spaces, meaning the command returned no usable directory. The function prints which probe (pkgconfigCmd or icuconfigCmd depending on pkgconfigIsValid) failed to parse and returns -1. It suggests the -O option to specify pkgdata.inc manually.","triggerScenarios":"The probe command ran (popen succeeded, fread returned bytes) but output was only whitespace/newlines, or the variable queried was empty — e.g. pkg-config found icu-uc but pkglibdir is unset, or icu-config printed a blank line.","commonSituations":"A malformed or partial ICU installation where the .pc file lacks the pkglibdir variable; icu-config shimmed by a wrapper that emits nothing; ICU installed to a path containing only spaces/newlines.","solutions":["Manually run the shown command to see its actual output and fix the install so it emits a real directory.","Reinstall ICU so 'pkg-config --variable=pkglibdir icu-uc' returns the lib dir.","Bypass detection with the -O option pointing at pkgdata.inc.","Verify the ICU .pc file is well-formed (grep pkglibdir icu-uc.pc)."],"exampleFix":"# before: empty pkglibdir variable\n$ pkg-config --variable=pkglibdir icu-uc\n(prints nothing)\n\n# after: reinstall so variable is set, or use -O\npkgdata -O /opt/icu/lib/icu/pkgdata.inc -p mypkg","handlingStrategy":"validation","validationCode":"# Verify the probe returns a non-empty, non-whitespace directory.\nout=$(pkg-config --variable=pkglibdir icu-uc 2>/dev/null)\n[ -z \"$out\" ] && out=$(icu-config --incpkgdatafile 2>/dev/null)\ncase \"$out\" in *[![:space:]]*) : ;; *) echo \"empty probe result; use -O\"; exit 1 ;; esac","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run the probe command manually to confirm it yields a real path.","Ensure the ICU .pc file defines pkglibdir.","Reinstall ICU if the .pc file is malformed.","Bypass with -O when the variable is missing."],"tags":["icu","pkgdata","build-tool","configuration","pkg-config"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}