Skip to content

debug: evicting a loaded location recreates its project #51198

Closed

Description

@telles0808

Description

DELETE /api/debug/location?location=<dir> ("Evict a loaded location") does not actually evict a loaded location: the location remains in GET /api/debug/location, and the project row for that location is re-created (new time_created) in /api/project.

Plugins

None.

OpenCode version

2.0.16

Steps to reproduce

  1. Have a loaded location that is not in use, e.g. C:\Users\<user>.
  2. DELETE /api/debug/location?location=C:\Users\<user>.
  3. GET /api/debug/location still lists it, and GET /api/project now includes a freshly created project for it.

Screenshot and/or share link

N/A.

Operating System

Windows 11 - Windows NT 10.0.26200 (win32 x64)

Terminal

OpenCode Desktop (Electron 44), not a terminal.

Additional context

Expected: evicting a loaded location removes it from the loaded set and does not recreate its project.

Activity

  1. ykakade commented on Sep 27, 2026

    @ykakade

    I can look into this!

  2. ykakade commented on Oct 4, 2026

    @ykakade

    Fix in #53066. GET /api/project was still going through the location middleware, so listing projects re-booted the server's default location right after it was evicted.

    Also, ?location=<dir> returns 400. The query has to be ?location[directory]=<dir>.

  3. opencodejr commented on Oct 28, 2026

    @opencodejr

    Thanks for the clear report! I reproduced this on 2.0.16, but it no longer happens on the latest dev (9adc42b), so it looks already fixed. The fix should be in the next release (the change was first tagged in v2.2.0).

    What I found on 2.0.16:

    • The eviction itself works: after DELETE /api/debug/location?location[directory]=<dir>, GET /api/debug/location comes back empty.
    • The next plain GET /api/project loads the location again. On that version the project routes loaded the server's default location (its working folder, which is your home folder in Desktop) whenever a request had no location, and that also looked the project up again.
    • On the latest dev, GET /api/project no longer loads a location, so an evicted location stays evicted.

    The parameter has to be written as ?location[directory]=<dir>. The plain ?location=<dir> form returns 400.

    Related, ordered by likelihood:

    The bot will close this issue in 1 day unless you reply that it still happens, e.g. on v2.2.0 or newer.

  4. opencodejr commented on Oct 29, 2026

    @opencodejr

    Closing this as completed, since there was no reply in the day since the last update. On 2.0.16, a location evicted with DELETE /api/debug/location?location[directory]=<dir> was loaded again by the next plain GET /api/project. On the latest dev (9adc42b) it stays evicted, so this looks fixed. The change was first tagged in v2.2.0 and should be in the next release.

    If it still happens on a newer version, please comment here or open a new issue with the version and the requests you sent. Note that the parameter has to be written as location[directory]; the plain ?location=<dir> form returns 400. If a location comes back in Desktop for another reason, #58795 may be the cause. Thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions