Troubleshooting
Troubleshooting Guide
This guide covers common issues you may encounter when using the Morphir .NET CLI and how to resolve them.
Installation Issues
Tool Not Found After Installation
Problem: After running dotnet tool install, the morphir command is not found.
Solution:
Check if tools are in PATH:
echo $PATH | grep .dotnet/toolsAdd to PATH if missing (Linux/macOS):
export PATH="$PATH:$HOME/.dotnet/tools"Add to PATH if missing (Windows):
$env:PATH += ";$env:USERPROFILE\.dotnet\tools"Restart your terminal after modifying PATH
Installation Fails with “Unable to find package”
Problem: dotnet tool install Morphir.CLI fails to find the package.
Solution:
Check NuGet sources:
dotnet nuget list sourceAdd nuget.org if missing:
dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.orgVerify package name - ensure you’re using the correct package name
Validation Issues
“File does not exist” Error
Problem:
Error: File does not exist: morphir-ir.json
Solutions:
Check file path:
ls -l morphir-ir.jsonUse absolute path:
morphir ir verify /full/path/to/morphir-ir.jsonCheck current directory:
pwd cd /path/to/ir/files morphir ir verify morphir-ir.json
Malformed JSON Errors
Problem:
Message: Malformed JSON: 'i' is an invalid start of a value. LineNumber: 6
Solutions:
Validate JSON syntax with a JSON validator:
cat morphir-ir.json | jq .Check for common issues:
- Missing commas between array/object elements
- Trailing commas (not allowed in JSON)
- Unquoted keys or values
- Invalid escape sequences
Use a JSON formatter:
cat morphir-ir.json | jq . > morphir-ir-formatted.json
Schema Version Detection Issues
Problem: Auto-detection selects the wrong schema version.
Solutions:
Explicitly specify version:
morphir ir verify --schema-version 3 morphir-ir.jsonCheck formatVersion field (for v2/v3):
cat morphir-ir.json | jq '.formatVersion'Verify IR structure:
- v1: No
formatVersionfield - v2:
"formatVersion": 2 - v3:
"formatVersion": 3
- v1: No
Validation Fails but IR Appears Correct
Problem: Validation reports errors, but you believe the IR is valid.
Investigation Steps:
Review error messages carefully - they include Expected vs. Found values
Check schema documentation - Schema Specifications
Validate against different versions:
morphir ir verify --schema-version 1 morphir-ir.json morphir ir verify --schema-version 2 morphir-ir.json morphir ir verify --schema-version 3 morphir-ir.jsonCompare with known-good IR:
# Validate a reference file morphir ir verify reference-morphir-ir.jsonCheck for common issues:
- Incorrect tag capitalization (e.g.,
"Public"vs"public") - Missing required fields
- Incorrect array structure
- Type mismatches
- Incorrect tag capitalization (e.g.,
Performance Issues
Validation Takes Too Long
Problem: Validation of large IR files (>1MB) takes several seconds.
Current Limitations:
- This is expected behavior for large files in Phase 1
- Schema validation is inherently slower for complex, deeply-nested JSON
Workarounds:
Use
--quietmode to reduce output overhead:morphir ir verify --quiet morphir-ir.jsonValidate in parallel (for multiple files):
find . -name "*.json" | xargs -P 4 -I {} morphir ir verify --quiet {}Phase 2 improvements (coming soon):
- Performance optimizations for batch processing
- Caching and incremental validation
High Memory Usage
Problem: Validation consumes excessive memory for very large IR files.
Solutions:
Check file size:
ls -lh morphir-ir.jsonFor files >10MB:
- Consider splitting into smaller modules
- Report the issue with file size details
Increase available memory (if using Docker):
docker run --memory 2g morphir-cli ir verify morphir-ir.json
CI/CD Integration Issues
CI Pipeline Doesn’t Fail on Invalid IR
Problem: Pipeline continues even when validation fails.
Solution: Check exit codes explicitly:
# GitHub Actions
- name: Validate IR
run: |
morphir ir verify morphir-ir.json
if [ $? -ne 0 ]; then
echo "Validation failed"
exit 1
fi
Or use set -e in bash scripts:
#!/bin/bash
set -e # Exit on any error
morphir ir verify morphir-ir.json
echo "Validation succeeded!"
JSON Output Not Parsed Correctly
Problem: CI tools can’t parse JSON output.
Solutions:
Verify JSON format:
morphir ir verify --json morphir-ir.json | jq .Save to file:
morphir ir verify --json morphir-ir.json > validation-result.jsonCheck for extra output:
- Use
--quietwith--jsonto suppress non-JSON output - Some logging may appear on stderr
- Use
Permission Denied in Docker
Problem:
Permission denied: /app/morphir-ir.json
Solution: Fix file permissions or use volume mounts:
# In Dockerfile
RUN chmod +r /app/*.json
# Or when running
docker run -v $(pwd):/app:ro morphir-cli ir verify /app/morphir-ir.json
Error Message Reference
Common Validation Errors
Missing Required Field
Path: $.distribution
Message: Required properties ["formatVersion"] are not present
Expected: required property
Found: undefined (missing)
Fix: Add the missing field to your JSON:
{
"formatVersion": 3,
"distribution": [ ... ]
}
Type Mismatch
Path: $.modules[0].name
Message: Value is "string" but should be "array"
Expected: array
Found: string
Fix: Change the field type:
// Incorrect
"name": "MyModule"
// Correct
"name": ["my", "module"]
Invalid Tag Value
Path: $.modules[0].accessControl
Message: Value must be one of: ["Public", "Private"]
Expected: "Public" or "Private"
Found: "public"
Fix: Use correct capitalization:
// Incorrect
"accessControl": "public"
// Correct
"accessControl": "Public"
Array Structure Error
Path: $.distribution[2]
Message: Expected array to have exactly 4 elements
Expected: array of length 4
Found: array of length 3
Fix: Ensure array has the correct number of elements per schema.
Reporting Issues
If you encounter an issue not covered here:
Check existing issues: GitHub Issues
Gather information:
- Morphir .NET CLI version:
morphir --version - .NET SDK version:
dotnet --version - Operating system and version
- Complete error message
- Minimal reproduction steps
- Morphir .NET CLI version:
Create a new issue with:
- Clear title describing the problem
- Steps to reproduce
- Expected vs. actual behavior
- Environment information
- Sample IR file (if possible) or minimal example
Getting Help
- Documentation: Morphir .NET Docs
- GitHub Issues: finos/morphir-dotnet/issues
- Community: FINOS Morphir
See Also
- CLI Reference - Complete command documentation
- morphir ir verify - Detailed verification command reference
- Schema Specifications - IR schema documentation
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.