Version: 1.0.0Documentation Index
Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
Use this file to discover all available pages before exploring further.
Last Updated: 2025-01-27
Status: Stable
Target Audience: Developers Troubleshooting common development issues in the Encore Health OS Platform.
Quick Reference
| Issue Category | Common Symptoms | Quick Fix |
|---|---|---|
| Build Errors | npm install fails, TypeScript errors | Check Node version, clear cache |
| Supabase Connection | ”Invalid Supabase URL”, CORS errors | Verify .env.local variables |
| Authentication | Login fails, session not persisting | Check auth configuration |
| TypeScript Errors | Type mismatches, missing types | Regenerate Supabase types |
| Performance | Slow builds, large bundle size | Check lazy loading, optimize imports |
| Mobile Issues | Layout breaks, touch targets too small | Verify responsive breakpoints |
Diagnostic Workflow
When encountering an issue, follow this workflow:- Check Error Message - Read the full error message and stack trace
- Verify Environment - Ensure
.env.localis configured correctly - Check Dependencies - Run
npm installto ensure packages are up to date - Clear Cache - Clear build-cache and restart dev server
- Check Documentation - Review relevant guides (see Related Documentation)
- Search Codebase - Look for similar patterns or error handling
- Check Logs - Review browser console and terminal output
Build & Dependency Issues
npm install Fails
Symptoms
npm ERR!messages during installation- Package resolution errors
- Permission denied errors
Solutions
-
Clear npm cache:
-
Check Node version:
-
Use correct package manager:
-
Check for conflicting packages:
TypeScript Build Errors
Symptoms
TS2307: Cannot find moduleerrors- Type mismatches
- Missing type definitions
Solutions
-
Regenerate Supabase types:
-
Restart TypeScript server:
- VS Code:
Cmd/Ctrl + Shift + P→ “TypeScript: Restart TS Server” - Or reload VS Code window
- VS Code:
-
Check import paths:
-
Verify tsconfig.json:
- Check
pathsconfiguration for@/alias - Ensure
includecontains all source files
- Check
Vite Build Errors
Symptoms
- Build fails with module resolution errors
- “Cannot find module” in production build
- Chunk loading errors
Solutions
-
Clear Vite cache:
-
Check for dynamic imports:
-
Verify environment variables:
- All
VITE_prefixed variables must be set - Check
.env.localexists and is properly formatted
- All
TypeScript Errors
Missing Type Definitions
Symptoms
TS2307: Cannot find module '@/...'TS2339: Property '...' does not exist on type
Solutions
-
Regenerate Supabase types:
-
Install missing type packages:
-
Check tsconfig.json paths:
Type Mismatches
Symptoms
TS2322: Type 'X' is not assignable to type 'Y'- Generic type errors
Solutions
-
Check component prop types:
-
Use type assertions carefully:
-
Check Supabase query return types:
Supabase Connection Issues
”Invalid Supabase URL” Error
Symptoms
- Connection fails on app load
- “Invalid Supabase URL” error message
Solutions
-
Verify
.env.localexists: -
Check URL format:
-
Restart dev server:
CORS Errors
Symptoms
CORS policy: No 'Access-Control-Allow-Origin' header- Requests blocked by browser
Solutions
-
Verify Supabase project URL:
- Check
VITE_SUPABASE_URLmatches your Supabase project - Ensure project is active in Supabase Dashboard
- Check
-
Check Supabase CORS settings:
- Supabase Dashboard → Settings → API
- Verify allowed origins include your domain
-
For edge functions:
“Missing required environment variables” Error
Symptoms
- App fails to start
- Error about missing Supabase variables
Solutions
-
Check
.env.localfile: -
Verify variable names:
-
Copy from
.env.example: - Restart dev server after changes
Supabase: Remote migration versions not found
Symptoms
supabase db pushfails withRemote migration versions not found in local migrations directory- CI or deployment jobs fail while reconciling migration history
Root Cause
Remote migration history contains versions that do not exist in localsupabase/migrations/ files.
Resolution Steps
- Inspect remote history:
- Compare with local files:
- Reconcile each missing version:
- Preferred: recreate the missing migration SQL file with the exact remote version and commit it
- If no-op: add a placeholder migration file documenting why it is empty
- Re-run sync:
Prevention
- Always create migration files first (
supabase migration new ...) - Commit migration files before applying to remote
- Avoid direct schema changes in Supabase Dashboard without corresponding migration files
Authentication Problems
Login Fails
Symptoms
- Login button does nothing
- Error message on login attempt
- Redirects back to login page
Solutions
-
Check Supabase auth configuration:
-
Check email/password format:
- Email must be valid format
- Password must meet Supabase requirements (min 6 characters)
-
Verify user exists:
- Check Supabase Dashboard → Authentication → Users
- Verify user is confirmed
-
Check browser console:
- Look for error messages
- Check Network tab for failed requests
Session Not Persisting
Symptoms
- User logged out on page refresh
- Session lost after closing browser
Solutions
-
Verify localStorage is enabled:
-
Check auth configuration:
-
Clear browser storage:
- Open DevTools → Application → Storage
- Clear localStorage and sessionStorage
- Try logging in again
”Unauthorized” Errors
Symptoms
- API calls return 401 Unauthorized
- RLS policies blocking access
Solutions
-
Verify user is authenticated:
-
Check RLS policies:
- Verify policies exist for the table
- Check policy conditions match user context
- See Database Development Guide for RLS patterns
-
Verify organization context:
Performance Issues
Slow Build Times
Symptoms
npm run buildtakes > 5 minutes- Dev server slow to start
Solutions
-
Check bundle size:
-
Optimize imports:
-
Use lazy loading:
-
Check for circular dependencies:
Large Bundle Size
Symptoms
- Initial bundle > 500KB
- Slow initial page load
Solutions
-
Analyze bundle:
-
Use code splitting:
-
Optimize images:
- Use WebP format
- Implement lazy loading for images
- Use appropriate image sizes
-
Check for duplicate dependencies:
Slow Query Performance
Symptoms
- Queries take > 1 second
- UI feels sluggish
Solutions
-
Check query optimization:
-
Use indexes:
- Check Supabase Dashboard → Database → Indexes
- Add indexes for frequently queried columns
-
Implement pagination:
-
Use QueryClient caching:
Mobile-Specific Issues
Layout Breaks on Mobile
Symptoms
- Content overflows screen
- Horizontal scrolling
- Elements overlap
Solutions
-
Use responsive utilities:
-
Use PageContainer:
-
Check safe areas:
-
Test on actual devices:
- Use browser dev tools mobile emulation
- Test on real iOS/Android devices
Touch Targets Too Small
Symptoms
- Buttons hard to tap
- Links difficult to click
Solutions
-
Use minimum touch target size:
-
Add adequate padding:
Mobile Navigation Issues
Symptoms
- Bottom nav overlaps content
- Menu not opening
- Gestures not working
Solutions
-
Add bottom padding for nav:
-
Check z-index:
-
Verify gesture handlers:
- Check
@/platform/gesturesimports - Verify gesture components are used correctly
- Check
Cross-Browser Compatibility
Safari-Specific Issues
Symptoms
- Layout breaks in Safari
- CSS not applying correctly
Solutions
-
Check CSS vendor prefixes:
-
Verify safe area support:
-
Check localStorage support:
- Safari in private mode blocks localStorage
- Check for localStorage availability
Chrome-Specific Issues
Symptoms
- Service worker not updating
- Cache issues
Solutions
-
Clear service worker:
- DevTools → Application → Service Workers
- Click “Unregister”
- Hard refresh (Ctrl+Shift+R)
-
Clear cache:
- DevTools → Application → Clear storage
- Clear site data
Git & GitHub CLI Connectivity
Verifying Git and GitHub CLI Setup
Use this checklist to verify Git andgh CLI are properly installed, authenticated, and connected to GitHub.
Git Verification
-
Check Git installation:
-
Verify user identity (required for commits):
If empty, set them:
-
Verify repository connection:
-
Windows line endings (recommended):
See Git / Line Endings (Windows) for details.
GitHub CLI (gh) Verification
-
Check
ghinstallation:If missing, install via:winget install GitHub.cli -
Verify authentication:
If not logged in, run:
gh auth login -
Verify repository access:
-
Check token scopes (if using GitHub Projects):
If missing, refresh with:
gh auth refresh -s project
Authentication Alignment
Both Git andgh should use the same protocol (HTTPS or SSH):
- HTTPS (recommended on Windows): Git remote should be
https://github.com/...andgh auth statusshould show “Git operations protocol: https” - SSH: Git remote should be
git@github.com:...and you should have SSH keys configured
gh uses SSH (or vice versa), they may not share credentials. Align them:
- For HTTPS: Ensure Git Credential Manager is installed (
git credential-manager --version) - For SSH: Ensure
ssh -T git@github.comsucceeds
Common Issues
| Issue | Solution |
|---|---|
git: command not found | Install Git for Windows; restart terminal |
gh: command not found | Install GitHub CLI; restart terminal; verify PATH |
Permission denied (publickey) | SSH key not loaded or not added to GitHub; or switch to HTTPS |
HTTP 403 / could not read Username | Re-authenticate: gh auth login and/or clear stale credentials in Windows Credential Manager |
| Wrong GitHub user | gh auth switch (newer gh) or gh auth logout then gh auth login |
Git / Line Endings (Windows)
Mass “changes” every time you reload the window
Symptoms
- After reloading the Cursor/VS Code window (or opening the project), Git shows hundreds of files as modified.
git statusorgit diffshows “LF will be replaced by CRLF” (or similar) for many files.- You did not edit those files; the only difference is line endings.
Cause
On Windows, Git can be configured to convert line endings to CRLF in the working copy while the repo stores LF. When the editor or Git “touches” files (e.g. on window reload), the mismatch makes every such file appear changed.One-time fix (do this once)
-
Tell Git to keep LF in the working copy (in this repo):
With
input, Git does not convert to CRLF on checkout, so files stay LF. -
Rewrite working copy to LF so it matches the index (Biome is already set to
lineEnding: "lf"):This rewrites all formatted files to LF. After this,git statusshould show no (or far fewer) changes. -
Optional: If you still see line-ending diffs in other files (e.g. outside Biome’s scope), refresh the index:
Prevention
- The repo’s
.gitattributesnow uses* text=auto eol=lfso that all text files use LF on checkout, regardless of OS. - Keep
core.autocrlf inputin this repo so Windows does not introduce CRLF again.
Quick Reference Table
| Issue | Quick Fix | Detailed Guide |
|---|---|---|
| Git/gh not connected | git fetch origin, gh auth status | Git & GitHub CLI Connectivity |
| Mass changes on reload (Windows) | git config core.autocrlf input then npm run format | Git / Line Endings |
| Build fails | npm cache clean --force && npm install | Build Issues |
| TypeScript errors | Restart TS server, regenerate types | TypeScript Errors |
| Supabase connection | Check .env.local variables | Supabase Issues |
| Auth not working | Verify auth config, check localStorage | Authentication |
| Slow performance | Check lazy loading, optimize queries | Performance |
| Mobile layout breaks | Use responsive classes, PageContainer | Mobile Issues |
| Browser compatibility | Check vendor prefixes, safe areas | Cross-Browser |
Related Documentation
Setup & Configuration
- Environment Variables - Environment variable configuration
- Setup Quick Start - First-time developer setup
- PWA Setup - PWA configuration and troubleshooting
Development Guides
- Database Development Guide - Database and RLS troubleshooting
- Performance Optimization Guide - Performance debugging
- Testing Setup and Run Guide - Test setup and debugging
Standards
- UI/UX Standards - UI/UX troubleshooting
- Spacing & UX Standards - Spacing issues
- Constitution - Core requirements and guardrails
Maintained By: Platform Foundation Team