{"record":{"id":"03841edb99aedb4d","repo":"mgth/LittleBigMouse","slug":"enter-at-least-one-key-command","errorCode":null,"errorMessage":"Enter at least one KEY_ command.","messagePattern":"Enter at least one KEY_ command\\.","errorType":"validation","errorClass":"FormatException","httpStatus":null,"severity":"error","filePath":"LittleBigMouse.Plugins/LittleBigMouse.Plugin.Vcp.Avalonia/RemoteMacro.cs","lineNumber":32,"sourceCode":"\n        foreach (var token in tokens)\n        {\n            if (int.TryParse(token, out var milliseconds))\n            {\n                if (result.Count == 0) throw new FormatException(\"A delay must follow a KEY_ command.\");\n                if (milliseconds is < 0 or > 10000)\n                    throw new FormatException(\"Macro delays must be between 0 and 10000 ms.\");\n                result[^1] = (result[^1].Key, TimeSpan.FromMilliseconds(milliseconds));\n                continue;\n            }\n\n            var key = token.ToUpperInvariant();\n            if (!key.StartsWith(\"KEY_\", StringComparison.Ordinal) || key.Any(char.IsWhiteSpace))\n                throw new FormatException($\"Invalid remote key: {token}\");\n            result.Add((key, TimeSpan.FromMilliseconds(150)));\n        }\n\n        if (result.Count == 0) throw new FormatException(\"Enter at least one KEY_ command.\");\n        return result;\n    }\n}\n","sourceCodeStart":14,"sourceCodeEnd":36,"githubUrl":"https://github.com/mgth/LittleBigMouse/blob/7a42f01d47d99d223b8ee33ba4019af82adf1c48/LittleBigMouse.Plugins/LittleBigMouse.Plugin.Vcp.Avalonia/RemoteMacro.cs#L14-L36","documentation":"Thrown at the end of RemoteMacro.Parse when the resulting macro is empty: either the sequence string was null/whitespace or it contained only separator characters and numeric delay tokens, so no actual KEY_ command was collected. It guards callers against sending a do-nothing macro to the remote-control channel.","triggerScenarios":"Thrown at LittleBigMouse.Plugins/LittleBigMouse.Plugin.Vcp.Avalonia/RemoteMacro.cs:32 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a macro sequence containing at least one KEY_ command, e.g. 'KEY_POWER'.","Remove separator-only content (commas, semicolons, plus signs, newlines) that yields no tokens.","Do not enter delays alone; a numeric token only modifies the preceding KEY_ command."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7a42f01d47d99d223b8ee33ba4019af82adf1c48","analyzedAt":"2026-09-16T00:35:00.514Z","contentChangedAt":"2026-09-16T00:35:00.514Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}