m MiniEHR / learn
Foundry ↗About MiniEHROpen workspace ↗
LESSON 9 OF 97 min read

9. Troubleshooting and glossary

Use the symptom to choose an investigation. Preserve commands, exit codes, and logs; do not turn a failing check into a claimed pass by weakening its requirements.

Common issues

SymptomLikely causeNext step
dotnet: command not foundSDK directory absent from PATHTry the absolute SDK path in lesson 1; inspect --info
SDK requested by global.json not foundInstalled SDK does not satisfy selectionCompare --list-sdks to global.json; human installs a matching SDK
Foundry says tests: Extra inputs are not permittedOlder CLI loadedUse the reviewed preview source path; verify it exists
Foundry asks for a signature/denies runtimes.manageExact host launch needs owner authorizationHuman reviews/signs the launch; do not bypass it
Session expired or already activeSession lifecycle conflictInspect session metadata and actual worker; renew/end/start through CLI appropriately
Connection refused on 5080No running/reachable APIInspect runtime state/logs, port, and actual launch outcome
Address already in useAnother process uses the portIdentify its owner before changing/stopping anything
Startup migration or SQLite open failurePath permissions/schema/access issueInspect runtime diagnostic and connection string; avoid deleting data to hide it
Netlify data-entry buttons are disabledExpected read-only demo behaviorBrowse synthetic records; connect a separately hosted backend before enabling writes
Netlify build demands MINIEHR_API_ORIGINNo backend origin configuredSupply the real public HTTPS backend origin; not a placeholder or localhost
API returns 400Missing/invalid inputInspect errors/detail, paired vitals, dates, note length, positive versions
API returns 404Wrong/missing ID, wrong clinical parent, or invalid GUID routeGET the parent and verify generated IDs
API returns 409Duplicate MRN, stale version, closed encounter, or SQLite contentionRead current state; decide how to reapply changes
Save succeeded but refresh failedWrite committed, follow-up read failedRefresh saved state; do not resubmit the already-confirmed write
dotnet passes but Foundry exits 1Known evidence reconciliation gapPreserve candidate and problems; consult FOUNDRY_GAPS.md
Foundry status shows no validationKnown task/workstream display gapInspect recorded validation events; absence from display is not proof no run happened

Read-only database inspection

If the synthetic local database from lesson 1 exists and sqlite3 is installed:

sh
sqlite3 -readonly /private/tmp/miniehr-frontend-synthetic.db '.tables'
sqlite3 -readonly /private/tmp/miniehr-frontend-synthetic.db \
  'SELECT MedicalRecordNumber, GivenName, FamilyName, Version FROM Patients;'
sqlite3 -readonly /private/tmp/miniehr-frontend-synthetic.db \
  'SELECT Id, IsClosed, ClosedAt, Version FROM Encounters;'

Expect Patients, Encounters, Vitals, Notes, and EF's migration history table among the tables. SQL column names correspond to mapped C# properties; JSON uses camelCase. This is supplementary inspection, not a new Foundry test artifact. Do not edit database rows to reopen encounters. To start fresh for another exercise, arrange a new synthetic database path in an owner-reviewed supervised launch; the API does not offer reset/delete.

Where to look when changing something

Intended changeRead first
Patient validationPatient.cs, Patients.cs, PatientTests.cs
HTTP request fieldsPatientsController.cs or ClinicalController.cs
Clinical write/closure behaviorEncounter.cs and ClinicalStore.cs
Database schemaEhrDbContext.cs, frozen migration models, persistence tests
Browser forms/messagesapp.js, index.html, app.css
Netlify proxybuild-netlify.mjs and netlify.toml
Engineering policy/evidenceAGENTS.md, .foundry config, docs/foundry reports

Use the source links in earlier lessons for these files. Request ownership before editing outside your assigned paths. Schema changes need a reviewed migration and upgrade tests, not modifications to a previously applied migration.

Glossary

TermPlain meaning
APIA program-facing interface; here HTTP routes returning JSON
AssemblyA compiled .NET unit, normally a DLL
AttributeMetadata such as Required or Fact interpreted by a framework
CandidateExact commit/tree proposed for evaluation/integration
Cancellation tokenSignal requesting that asynchronous work stop
CompilerTool translating C# into compiled code and reporting diagnostics
ConcurrencyOverlapping operations that may compete over state
Connection stringSettings telling a database provider where/how to connect
ControllerClass whose methods handle HTTP routes
DbContextEF's working object for queries, tracking, and saving
Dependency injectionSupplying an object's dependencies from registered services
DomainObjects and business rules independent of HTTP/storage mechanics
DTOData transfer object describing transport input/output
EgressOutbound network access from an execution boundary
EncounterA record of an interaction with a patient
EntityObject with identity and lifecycle persisted by the application
Foreign keyDatabase reference to a parent row
GUIDIdentifier used for patient/encounter/content IDs
IdempotentRepeating an operation preserves its original effective result
Integration testTest spanning components, such as HTTP plus actual SQLite
LINQC# query operations over data sources/collections
MigrationVersioned change to database schema
MiddlewareA step in the web request pipeline
MRNMedical record number; a unique synthetic identifier here
NuGet.NET package distribution system
Optimistic concurrencyRejecting writes if the expected version is no longer current
OriginScheme, host, and port identifying a web origin
ORMTool mapping objects and database operations; EF Core is used here
PaginationSplitting a collection into pages
Primary keyValue uniquely identifying a row
Problem DetailsStructured HTTP error response
Proxy rewriteHosting rule forwarding a browser request to another server
RollbackUndoing uncommitted transaction changes
Runtime.NET execution environment; in Foundry, a supervised process record
ScopeLifetime of dependency-injected objects; also the coverage of a validation
SDKDevelopment kit containing compiler and development tools
SolutionGroup of related .NET projects
Static assetFile served directly, such as HTML, CSS, or JavaScript
Synthetic dataInvented information representing no real patient
TaskC# asynchronous operation; in Foundry, an engineering objective
TransactionDatabase operation group that commits or rolls back together
TRXMachine-readable .NET test report
Unit testFocused test of behavior without the whole application stack
WorkstreamAssigned engineering scope with role/ownership

Final learning check

You should be able to explain how a request reaches the controller, how the domain validates it, how EF persists it, how versions avoid overwrites, why closure is atomic, why the hosted preview needs a backend, and why passing C# tests does not yet establish Foundry acceptance. Revisit the relevant lesson for any unclear step.

Return: Tutorial index.

MiniEHR learning guide · Based on this project’s source · Read on GitHub