PromptBase
PromptBase SelectGet Select
Close icon
General
Home
Marketplace
Create
Hire
Login
Chat
Sell
Explore

Prompt Details

Model
Chat - (gpt-5.6)
Token size
1,589
Example input
[PROBLEM]: Node.js API works when manually started but fails under systemd with a database configuration error. [SYSTEM_CONTEXT]: Ubuntu server. Express API. PostgreSQL. Manual shell launch succeeds. systemd logs report DATABASE_URL missing. Environment variable exists in the user's interactive shell. Service file launches /srv/app/server.js. [AVAILABLE_TOOLS]: Repository inspection, shell commands, systemctl status, journalctl, test suite, service restart. [CONSTRAINTS]: Do not change database data. Do not expose credentials. Avoid unrelated application changes. Service downtime should be minimal. [SUCCESS_CRITERIA]: systemd service starts successfully; health endpoint returns HTTP 200; database-backed endpoint succeeds; relevant tests pass; restart produces no configuration error in logs.
Example output
### STATUS **PLAN ONLY** ### ROOT CAUSE The strongest diagnosis is that `DATABASE_URL` exists only in the interactive user's shell environment and is **not being supplied to the systemd service**. This explains the full symptom pattern: * manual launch succeeds * systemd launch fails * systemd specifically reports `DATABASE_URL` missing * systemd services do not automatically inherit variables exported from `.bashrc`, `.profile`, or an existing interactive shell This is strongly supported, but not VERIFIED because I cannot inspect the actual Ubuntu host. ### EVIDENCE Observed from the supplied evidence: * The Express API works when manually started. * PostgreSQL connectivity therefore works under at least one runtime environment. * `DATABASE_URL` exists in the interactive shell. * The same application fails under systemd specifically because `DATABASE_URL` is missing. * systemd launches `/srv/app/server.js`. The cheapest discriminating investigation is therefore the service's environment configuration, not application or database code. Run without printing the credential: ```bash systemctl status <service> --no-pager journalctl -u <service> -n 100 --no-pager systemctl cat <service> test -n "$DATABASE_URL" \ && echo "interactive DATABASE_URL: SET" \ || echo "interactive DATABASE_URL: MISSING" ``` Inspect the unit for: ```ini Environment= EnvironmentFile= User= WorkingDirectory= ExecStart= ``` Also safely test whether a configured environment file contains the variable: ```bash sudo grep -q '^DATABASE_URL=' /path/to/environment-file \ && echo "service DATABASE_URL: CONFIGURED" \ || echo "service DATABASE_URL: NOT CONFIGURED" ``` Do **not** `cat` the environment file or print `$DATABASE_URL`. ### CHANGES No changes were executed from this chat. If inspection confirms there is no systemd environment source for `DATABASE_URL`, the smallest appropriate repair is to provide the service with an explicit environment file rather than changing application code. For example: ```ini [Service] EnvironmentFile=/etc/<service>.env ``` Create that file with restrictive permissions: ```bash sudo install -m 600 -o root -g root /dev/null /etc/<service>.env sudoedit /etc/<service>.env ``` Its contents would contain: ```text DATABASE_URL=<existing database URL> ``` Then: ```bash sudo systemctl daemon-reload sudo systemctl restart <service> ``` This keeps the database unchanged and avoids an unrelated application refactor. If the existing unit already specifies an `EnvironmentFile`, repair that existing configuration instead of introducing a second configuration mechanism. ### VERIFICATION **Executed verification:** None. I do not have execution access to the supplied Ubuntu system. **Required verification after the repair:** ```bash systemctl is-active <service> systemctl status <service> --no-pager ``` Expected: ```text active ``` Then verify the original configuration error is gone: ```bash journalctl -u <service> --since "5 minutes ago" --no-pager ``` There should be no new `DATABASE_URL missing` configuration error. Verify health: ```bash curl -fsS -o /dev/null -w '%{http_code}\n' http://127.0.0.1:<port>/<health-endpoint> ``` Expected: ```text 200 ``` Then call a known read-only database-backed endpoint: ```bash curl -fsS http://127.0.0.1:<port>/<database-backed-endpoint> ``` It must return its normal successful response. Run the relevant test suite from `/srv/app`: ```bash cd /srv/app npm test ``` Finally verify restart persistence: ```bash sudo systemctl restart <service> systemctl is-active <service> journalctl -u <service> --since "2 minutes ago" --no-pager ``` The service must remain active and the database configuration error must not reappear. ### SUCCESS CRITERIA | Criterion | Status | Evidence | | --------------------------------------- | ---------------- | ------------------------------------------ | | systemd service starts successfully | **NOT VERIFIED** | Requires execution on host | | health endpoint returns HTTP 200 | **NOT VERIFIED** | Requires runtime request | | database-backed endpoint succeeds | **NOT VERIFIED** | Requires runtime request | | relevant tests pass | **NOT VERIFIED** | Tests not executable from this environment | | restart produces no configuration error | **NOT VERIFIED** | Requires restart and journal inspection | ### RESIDUAL RISKS If `DATABASE_URL` is already configured in the unit, the next likely issue is that the referenced `EnvironmentFile` is missing, unreadable, incorrectly formatted, or overridden by another unit/drop-in. `systemctl cat <service>` would expose that immediately without requiring application changes. ### NEXT REQUIRED ACTION Run: ```bash systemctl cat <service> ``` and establish whether the service has an `Environment=` or `EnvironmentFile=` source for `DATABASE_URL`. That is the highest-value next diagnostic before changing anything.
GPT

Autonomous Debug Until Verified

Add to Cart
Instant accessInstant access
Usage rightsCommercial use
Money-back guaranteeMoney‑back
By purchasing this prompt, you agree to our terms of service
GPT-5.6
Tested icon
Guide icon
4 examples icon
Free credits icon
Turn an AI coding agent into an evidence-first debugger that keeps working until the problem is actually verified as fixed. It investigates before editing, tests hypotheses, makes minimal changes, runs verification, treats failures as new evidence and continues instead of stopping after the first patch. Works across codebases, CI failures, APIs, deployments and services, with a safe plan-only fallback when execution tools are unavailable.
...more
Added over 1 month ago
Report
Browse Marketplace