Internal error: Supposedly valid service did not have command
- Dominant language
- TypeScript
- Stars
- 6.4k
- Forks
- 128
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 4
Description
A config like
```json
"foo": {
"service": true,
"dependencies": [
"bar"
]
},
```
is not highlighted as invalid by the extension.
Having such a config seems to cause the extension to crash repeatedly
```
Error: Internal error: Supposedly valid service did not have command
at on._checkForCyclesAndSortDependencies (c:\Users\Temm\.vscode\extensions\google.wireit-0.6.0\server.js:42:20959)
at on.analyzeFiles (c:\Users\Temm\.vscode\extensions\google.wireit-0.6.0\server.js:42:4600)
at async ii.getDiagnostics (c:\Users\Temm\.vscode\extensions\google.wireit-0.6.0\server.js:42:24688)
at async Au (c:\Users\Temm\.vscode\extensions\google.wireit-0.6.0\server.js:42:29636)
[Error - 2:30:09 AM] The wireit server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
```
It seems that the extension does not properly check the rule that service scripts must have a command
https://github.com/google/wireit/blob/28cb48bb13ee4d0800dd9c491b10f6ec3aa14fdc/src/analyzer.ts#L1529-L1537
> we should never get here. We throw here to convince TypeScript that this is guaranteed.
Very amusing comment.
Notably, a service script with an invalid dependency will properly throw
```json
"foo": {
"service": true,
"dependencies": [
"doesnotexist"
]
},
```
results in these two errors:
```
A "service" script must have a "command". wireit
Cannot find script named "bar" in package "s:\Dev\projectname" wireit
```
Contributor guide
Assessment
This issue has not been assessed yet.