ProjectCommandError enum

Standard error categories for project commands.

Each error type corresponds to a specific failure scenario with associated resolution guidance.

Inheritance
Available extensions

Values

configurationMissing → const ProjectCommandError

Configuration file is missing or invalid

This error occurs when the morpheme.yaml configuration file is missing, corrupted, or contains invalid syntax.

Resolution:

  • Run morpheme init to create a new configuration file
  • Check the syntax of existing morpheme.yaml file
  • Refer to documentation for proper configuration format

Example:

// This will trigger configurationMissing if morpheme.yaml doesn't exist
morpheme build apk
invalidPath → const ProjectCommandError

File or directory path is invalid

This error occurs when a specified file or directory path does not exist, is inaccessible, or has incorrect permissions.

Resolution:

  • Verify the path exists using ls or file explorer
  • Check file/directory permissions
  • Use absolute paths when relative paths are problematic

Example:

// This will trigger invalidPath if ./lib/nonexistent.dart doesn't exist
morpheme generate page nonexistent --path ./lib/nonexistent.dart
dependencyFailure → const ProjectCommandError

Dependency installation or resolution failed

This error occurs when package dependencies cannot be installed or resolved, typically due to network issues or package conflicts.

Resolution:

  • Check internet connectivity
  • Run flutter pub get manually
  • Clear pub cache with flutter pub cache repair
  • Check for package version conflicts in pubspec.yaml

Example:

// This may trigger dependencyFailure if packages can't be resolved
morpheme get
buildFailure → const ProjectCommandError

Build process failed

This error occurs when the Flutter build process encounters compilation errors, missing assets, or configuration issues.

Resolution:

  • Run flutter clean to clear build artifacts
  • Check for Dart compilation errors
  • Verify all required assets are present
  • Ensure proper signing configuration for release builds

Example:

// This may trigger buildFailure if there are compilation errors
morpheme build apk
networkError → const ProjectCommandError

Network connectivity issues

This error occurs when network operations fail due to connectivity problems, timeouts, or unreachable servers.

Resolution:

  • Check internet connection
  • Verify firewall settings
  • Try again later if servers are temporarily unavailable
  • Use VPN if geographic restrictions apply

Example:

// This may trigger networkError if pub.flutter-io.cn is unreachable
morpheme upgrade
permissionDenied → const ProjectCommandError

File system permission denied

This error occurs when the CLI lacks necessary permissions to read, write, or execute files in the specified locations.

Resolution:

  • Run command with appropriate privileges (sudo on Unix systems)
  • Check file and directory permissions
  • Ensure write access to project directory
  • Verify ownership of files and directories

Example:

// This may trigger permissionDenied if writing to protected directories
morpheme create my_app --path /usr/local/bin
invalidArguments → const ProjectCommandError

Invalid command arguments

This error occurs when command-line arguments are missing, malformed, or contain invalid values for the specified command.

Resolution:

  • Check command syntax with morpheme help [command]
  • Verify all required arguments are provided
  • Ensure argument values are in correct format
  • Use proper quoting for arguments with spaces

Example:

// This will trigger invalidArguments due to missing required argument
morpheme generate feature
missingDependencies → const ProjectCommandError

Required tools or dependencies missing

This error occurs when essential tools like Flutter, Dart SDK, or third-party dependencies are not installed or not in PATH.

Resolution:

  • Install missing tools (Flutter, Dart, etc.)
  • Add tools to system PATH
  • Run morpheme doctor to diagnose environment issues
  • Check tool versions for compatibility

Example:

// This will trigger missingDependencies if Flutter is not installed
morpheme create my_app
timeout → const ProjectCommandError

Operation timeout

This error occurs when operations exceed the allowed time limit, typically due to slow network, heavy computation, or system load.

Resolution:

  • Try the operation again
  • Check system resources (CPU, memory, disk I/O)
  • Increase timeout values if configurable
  • Optimize project structure for faster operations

Example:

// This may trigger timeout during long-running builds
morpheme build appbundle
unknown → const ProjectCommandError

Unknown or unexpected error

This error occurs when an unexpected exception is caught that doesn't fit into any of the predefined error categories.

Resolution:

  • Check the detailed error message and stack trace
  • Report the issue to Morpheme CLI team with reproduction steps
  • Try alternative approaches to achieve the same goal
  • Check for updates that may fix the issue

Example:

// This may trigger unknown for unhandled exceptions
morpheme [any_command]

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
name String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

values → const List<ProjectCommandError>
A constant List of the values in this enum, in order of their declaration.