# Kotlin Compile Pitfalls (2026-05)
Additions for android-project-build Pitfalls section.

## Hermes read_file → write_file corruption
`hermes_tools.read_file()` returns content with `LINENUM|CONTENT` prefixes. Passing this raw output to `write_file()` corrupts the source file; the Kotlin compiler sees `1|package...` and fails on every line. Always extract via `content['content']` and strip line numbers. For simple string replacements prefer `terminal` with `sed`.

## Unicode box-drawing chars break KSP
Chars like ═ ║ ╔ ╗ in Kotlin comments cause KSP (Hilt/Room) to fail with "Function declaration must have a name" + cascading "Expecting a top level declaration" errors. Use plain ASCII `---` dividers.

## Dagger DuplicateBindings
Two `@Module` classes providing the same `@Provides` type → `[Dagger/DuplicateBindings]`. Remove duplicate from less-canonical module. Room DAOs belong in the database module (`LocalDataModule`), not feature modules (`CatalogBackendModule`).

## Missing Compose imports
- `Modifier.border()` needs `import androidx.compose.foundation.border` (separate from `background`/`clickable`)
- TV `Icon` composable needs `import androidx.tv.material3.Icon` (not `material3.Icon` or `material.Icon`)
- `AlertDialog` needs `import androidx.compose.material3.AlertDialog`

## Unused import cleanup
Mismatched `TextButton` imports can conflict — a local composable named `TextButton` will clash with `androidx.compose.material3.TextButton`. Rename custom composables to avoid the conflict (e.g., `CatalogTextButton`).

## Hilt ViewModel default params
`hiltViewModel()` as default (e.g., `fun Screen(vm: VM = hiltViewModel())`) works with `@Composable` + `hilt-navigation-compose` dependency.

## Icon availability
`Icons.Default.Widgets` and `Icons.Default.Dashboard` don't exist in the material-icons-extended library on older Compose BOMs. Use `Icons.Default.List` or `Icons.Default.ViewModule` as fallbacks — but even those may fail. Stick to the guaranteed set: Home, Search, Movie, Tv, Settings, Star, BookmarkBorder, Check, Favorite, Person, Extension, Api, Cloud, Tune, PlayArrow, Menu, Sort, Category, LiveTv, AutoAwesome, ChildCare.
