dotnet/orleans · error · ArgumentException
Missing value for {name}.
Error message
Missing value for {name}. What it means
Thrown by the sample's command-line parser GetOptionValue when a flag like --connection-string, --container, or --blob is the very last token on the command line, so there is no following token to use as its value. It is a hard input-validation failure in the Program.Main path that builds the run configuration.
Source
Thrown at samples/JournalingAzureBlobJson/JournalingAzureBlobJson/Program.cs:220
?? DefaultBlobName;
var resetBlob = !args.Contains("--no-reset", StringComparer.OrdinalIgnoreCase);
return new(connectionString, containerName, blobName, resetBlob);
}
private static string? GetOptionValue(string[] args, string name)
{
for (var i = 0; i < args.Length; i++)
{
if (!string.Equals(args[i], name, StringComparison.OrdinalIgnoreCase))
{
continue;
}
if (i + 1 == args.Length)
{
throw new ArgumentException($"Missing value for {name}.");
}
return args[i + 1];
}
return null;
}
}
}
public interface IJournaledSampleGrain : IGrainWithStringKey
{
Task<JournaledSampleSummary> RunScenario();
Task<JournaledSampleSummary> GetSummary();
Task Deactivate();
}
public sealed class JournaledSampleGrain(View on GitHub (pinned to fca799fa70)
Solutions
- Supply the missing argument immediately after the flag, e.g. `dotnet run -- --connection-string "<Azure storage conn string>"`.
- If you intended the flag to be optional, remove it entirely so the sample falls back to the AZURE_STORAGE_CONNECTION_STRING environment variable / default blob name.
- Check your shell quoting: a value containing spaces must be quoted so it does not get split into separate args.
Example fix
// before GetOptionValue(args, "--connection-string") // throws if --connection-string is last token // after: always pair the flag with its value on the command line dotnet run -- --connection-string "DefaultEndpointsProtocol=..." --container journaling
Defensive patterns
Strategy: validation
Validate before calling
// Validate flag/value pairing before delegating to GetOptionValue
for (var i = 0; i < args.Length - 1; i++)
if (args[i].StartsWith("--") && args[i + 1].StartsWith("--"))
Console.WriteLine($"Warning: flag {args[i]} may be missing its value."); Type guard
null
Try / catch
null
Prevention
- Always quote values containing spaces so the shell does not split them.
- Keep flags adjacent to their values on the command line.
- For optional flags, omit them entirely rather than leaving them dangling.
When it happens
Trigger: Invoking the sample as `dotnet run -- --connection-string` (or --container / --blob) with nothing after the flag. The loop finds the flag at index i, then i + 1 == args.Length is true, so it throws ArgumentException instead of returning null.
Common situations: Copy-pasting a command and truncating it; quoting a value that the shell then drops; moving the flag to the end of the line and forgetting its argument; passing a value that starts with -- which is technically accepted but often a mistake.
Related errors
- WEBSITE_PRIVATE_PORTS must contain at least one TCP port.
- The required setting '{name}' isn't configured.
- AzureTable:ServiceUri must be an absolute HTTPS Azure Table
- AZURE_CLIENT_ID must contain the user-assigned managed ident
- Configure AzureTable:ServiceUri for Azure, or use Azurite wi
AI-assisted analysis of dotnet/orleans@fca799fa70 (2026-08-13).
Data as JSON: /api/errors/bd301b2f718cdb89.
Report an issue: GitHub.