What the agent does
The agent reads the error before the dependency. Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/adapters/http' is not defined by "exports" in .../node_modules/axios/package.json is Node refusing a path that the package's exports map does not list. In a small client library like emresenyuva/youtube-music-api, package.json declares "axios": ">=0.21.1" with no lock file, so every fresh npm install takes the newest axios, and src/index.js line 2 reads axios.defaults.adapter = require('axios/lib/adapters/http'). That line is the whole problem: axios 0.21.1 had no exports field, so any file inside the package could be required; axios 1.0.0 added one, and from then on only the listed subpaths resolve.
Then it checks what the current package does export. In the current axios 1.x the map lists ., ./lib/adapters/http.js and ./lib/adapters/xhr.js (with the extension), an ./unsafe/* prefix, ./package.json and the two dist bundles, and the package is "type": "module", so lib/adapters/http.js is an ES module. Requiring it with the extension does load on a current Node, but hands back a module object whose default is the adapter, so the assignment would silently store the wrong thing. The agent also asks why the line exists at all: it forces axios to use Node's http adapter instead of picking one by environment, which matters for a library that people have tried to run in a browser (issue #11 in the repository is a CORS report).
The fix is axios.defaults.adapter = 'http'. axios' own README says an adapter can be named: "you can set the name of the built-in adapter, or provide an array with their names", with 'xhr', 'fetch', 'http' or a list of them. That keeps the author's intent, forces the Node adapter, and needs no path into the package. The agent then proves it: the package has no test script ("test": "echo \"Error: no test specified\" && exit 1"), but src/tests/index.js shows the intended smoke test, initalize() followed by a search. The agent runs initalize(), which fetches https://music.youtube.com/ and parses the ytcfg.set( blocks, and then getSearchSuggestions, and records that both answer.
It also reads how the client is built, axios.create({ baseURL, headers, withCredentials: true }) at line 15 with request and response interceptors that carry a tough-cookie jar, to make sure the adapter is the only axios 1.x change that bites here, and writes down the >=0.21.1 range as the reason the break arrived with no change to the repository.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Our Node library throws \"Package subpath './lib/adapters/http' is not defined by \"exports\"\" from axios on a fresh install. Find every require of a path inside the axios package, say why each exists, and replace each with what the current axios exports or documents, keeping the adapter choice the author made. Explain which axios version introduced the exports map and why our version range picked it up. Run the smoke test the repository has, or the smallest real request that proves the client works, and open a pull request with the output.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
A pull request that changes one line in src/index.js: the deep require becomes axios.defaults.adapter = 'http'. The description quotes the Node error, lists what the installed axios's exports map allows, names 1.0.0 as the release that added the map and >=0.21.1 as the range that let it in, and pastes the output of initalize() and a suggestions call made through the fixed client.
A reviewer checks that the adapter is still forced to Node's http implementation, that no other axios/lib/... path remains, and decides whether to add a lock file or tighten the range so the next axios major arrives on purpose rather than on the next install.
Run it on every Dependabot pull request that bumps axios
With a lock file, the break arrives with the bump, so the trigger is the pull request that moves axios past 1.0. An automation with a github trigger on pull_request.opened and pull_request.synchronize runs this prompt on each one, with the event appended after the prompt, and pushes the adapter change onto the bump's branch when the require fails.
For many services that pin an old axios or use an open range, your server sends this request once per repository, each with its own UUID as request_id so a retry returns the run already started, and reads each run.completed webhook; a key starts at most max_concurrent runs at once and queues the rest.
The use case this job follows, with its automation and trigger: Fix a bug from an alert.
Why run it on Rush?
An exports map turns a path that worked for years into a hard error at require time, and the obvious patches (add .js, reach through unsafe/) load something subtly different. In a Rush sandbox the agent installs the current package, reads its real exports field and its README, and picks the documented form, with the install and the failing require kept in the run so the reviewer sees the before as well as the after.
A client library is only proven by a request. The sandbox has network access, so the agent calls the real endpoint the library wraps and records the answer, instead of asserting that a one-line change probably works.
Frequently asked questions
Why not require 'axios/lib/adapters/http.js' with the extension?
It is in the current exports map, so Node resolves it, but the file is an ES module in a package marked "type": "module". A require of it on a Node that allows that returns a namespace object whose default is the adapter, so axios.defaults.adapter would hold the wrong value. The adapter name is the documented way and has no such edge.
Does naming the adapter change how requests are made?
No. 'http' selects the same Node http adapter the deep require used to load. The agent proves it by running the library's own initialisation request and a search against the live service and pasting both answers.
Why did this break without any change to our code?
Because the dependency is ">=0.21.1" and there is no lock file, so each install takes the newest axios. axios 1.0.0 added the exports map; anything installed after that release refuses the old path. The pull request says so and leaves the choice of a lock file or a tighter range to you.
Will the agent add tests to a package that has none?
It runs the smoke script the repository already has under src/tests and records the output. It does not invent a test suite for a library whose only test command exits with an error; it says that is the state and lets you decide.