Skip to content

create-migration does not work from non server directory #4430

Closed

Description

@exaby73

Describe the bug

We recently added support for running serverpod generate from any directory within the project. This change was done in the generator config's load factory. This factory is used by other commands such as the migration set of commands.

In a monorepo project, in the following scenarios where a root pubspec with name: _ may exist (pub workspaces):

  1. [Expected] A project with a single _server directory such as a fresh project from serverpod create

We get the following error outputted:

Not a server package (_). Please make sure your server package name ends with '_server'.
  1. [Bug] A project with multiple _server directories exist, such as a monorepo with the server and custom modules in a workspace configuration

We get the following error outputted:

Multiple Serverpod server projects found. Select one:
(○) /path/to/foo/module/bar/bar_server
(●) /path/to/foo/foo_server

Press [Enter] to confirm.
Not a server package (_). Please make sure your server package name ends with '_server'.

To reproduce

See above description

Expected behavior

We should either:

  1. Immediately fail without trying to resolve the server directory
  2. (Preferred) we should allow all CLI commands to be run from any directory, taking advantage of the interactive server directory prompt

This should also be extended to other commands. All commands using GeneratorConfig.load will have this issue if we aren't using the resolved by GeneratorConfig.load.

Library version

Current main as of posting this issue / version 3.0.1

Platform information

N/A

Additional context

Tests for this should exist in tests/serverpod_cli_e2e_test/test

How experienced are you with this library?

Expert - Experienced and comfortable with using this library in complex projects

Are you interested in working on a PR for this?

  • I want to work on this

Activity

  1. added
    bug
    on Dec 11, 2025
  2. SandPod commented on Dec 12, 2025

    @SandPod
    Contributor

    I see that there is something wrong but I don't understand the issue.

    Is 1 under Describe the bug expected behavior? It looks like a bug to me.

    I would say 2 is working as intended. If we have multiple Serverpod projects that exist and we start the search at a location where we can't unambiguously determine which project is intended, we should prompt the user for feedback.

  3. moved this from Inbox 📫 to In Progress 🔥 in Serverpod Frameworkson Dec 12, 2025
  4. moved this from In Progress 🔥 to Done 🚀 in Serverpod Frameworkson Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions