{"record":{"id":"50f5685ff6ef326e","repo":"abhigyanpatwari/GitNexus","slug":"options-languagelabel-package-siblings-unkn","errorCode":null,"errorMessage":"[${options.languageLabel}-package-siblings] ${unknownPackageFiles.size} file(s) lacked reliable package facts; wildcard attribution disabled for this language workspace","messagePattern":"\\[(.+?)-package-siblings\\] (.+?) file\\(s\\) lacked reliable package facts; wildcard attribution disabled for this language workspace","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"gitnexus/src/core/ingestion/languages/jvm/package-siblings.ts","lineNumber":88,"sourceCode":"        unknownPackageFiles.add(parsed.filePath);\n        continue;\n      }\n      const packageName = packageFact.packageName;\n      const bucket = buckets.get(packageName) ?? { parsed: [], moduleScopes: [] };\n      buckets.set(packageName, bucket);\n      bucket.parsed.push(parsed);\n      const moduleScope = parsed.scopes.find((scope) => scope.kind === 'Module');\n      if (moduleScope !== undefined) {\n        bucket.moduleScopes.push({ filePath: parsed.filePath, scope: moduleScope });\n      }\n    }\n\n    // A file whose package cannot be proven may shadow a wildcard-imported\n    // type in any package. Conservatively disable wildcard attribution for the\n    // language workspace while leaving explicit/FQN imports available.\n    if (unknownPackageFiles.size > 0) {\n      for (const parsed of parsedFiles) incompleteFiles.add(parsed.filePath);\n      logger.warn(\n        `[${options.languageLabel}-package-siblings] ${unknownPackageFiles.size} file(s) lacked reliable package facts; wildcard attribution disabled for this language workspace`,\n      );\n    }\n\n    const augmentations = indexes.bindingAugmentations as Map<ScopeId, Map<string, BindingRef[]>>;\n    const maxInjectedSiblings = getMaxInjectedSiblings();\n    let truncatedFiles = 0;\n\n    for (const bucket of buckets.values()) {\n      if (bucket.moduleScopes.length < 2) continue;\n      if (bucket.moduleScopes.length > MAX_PACKAGE_FILES) {\n        for (const parsed of bucket.parsed) incompleteFiles.add(parsed.filePath);\n        logger.warn(\n          `[${options.languageLabel}-package-siblings] skipping package with ${bucket.moduleScopes.length} files (cap=${MAX_PACKAGE_FILES}); same-package implicit visibility disabled for this package`,\n        );\n        continue;\n      }\n","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/aac7515d2a8c50a1f8f923c6fb77218b333560d6/gitnexus/src/core/ingestion/languages/jvm/package-siblings.ts#L70-L106","documentation":"During JVM-language (Java/Kotlin) ingestion, GitNexus buckets parsed files by package to simulate same-package implicit visibility for wildcard imports. A file whose package cannot be proven (getPackageFact returns undefined) may shadow any wildcard-imported type, so the indexer conservatively disables wildcard attribution for the entire language workspace, marks the unknown-package files incomplete, and warns. Explicit and fully-qualified-name imports still resolve; only wildcard/same-package inference is degraded.","triggerScenarios":"populateNamespaceSiblings runs over parsedFiles where at least one file yields no reliable package fact (missing/unparseable package declaration, absent build metadata for Kotlin) while other files share packages; unknownPackageFiles.size > 0 fires the warning and adds every parsed file to incompleteFiles.","commonSituations":"Generated or template Java sources without package lines, partially checked-out monorepos where pom.xml/build.gradle facts are excluded by .gitnexusignore, Kotlin workspaces lacking build files, or files with BOM/encoding damage that breaks package-declaration detection.","solutions":["Verify the affected files carry a valid, first-statement package declaration (Java) or correct build metadata (Kotlin)","Check .gitnexusignore is not excluding build files (pom.xml, build.gradle.kts) that supply package facts, then re-run analyze","If the files are generated/vendored and irrelevant, exclude them via .gitnexusignore and re-analyze","Accept the degradation when wildcard-resolution precision is not needed — explicit and FQN imports still resolve"],"exampleFix":"// before — src/generated/Template.java (no package declaration)\npublic class Template { /* ... */ }\n\n// after\npackage com.acme.generated;\npublic class Template { /* ... */ }","handlingStrategy":"validation","validationCode":"// Pre-flight: every .java file must declare a package on the first non-comment line\nimport { readFileSync } from 'node:fs';\nconst bad = files.filter((f) => f.endsWith('.java') && !/^\\s*(\\/\\/.*\\n|\\/\\*[\\s\\S]*?\\*\\/\\s*)*package\\s+[\\w.]+;/.test(readFileSync(f, 'utf8')));\nif (bad.length > 0) console.error('package-facts will be unreliable for:', bad);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep a lint rule (e.g. eslint/spotless 'require-package' or checkstyle RegexpSingleline) enforcing Java package declarations in CI","Do not .gitnexusignore build files that supply Kotlin/Java package facts","Run a pre-analyze sanity script listing files without package declarations and fix or exclude them"],"tags":["jvm","java","kotlin","ingestion","wildcard-imports","scope-resolution"],"backgroundTag":"import-resolution-incomplete","analyzedSha":"aac7515d2a8c50a1f8f923c6fb77218b333560d6","analyzedAt":"2026-08-20T23:29:22.980Z","contentChangedAt":"2026-08-20T23:29:22.980Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}