{"record":{"id":"9a1b9952b88a990c","repo":"tursodatabase/turso","slug":"parameter-parametername-not-found-9a1b99","errorCode":null,"errorMessage":"Parameter {parameterName} not found","messagePattern":"Parameter (.+?) not found","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"bindings/dotnet/src/Turso.Data/TursoParameterCollection.cs","lineNumber":95,"sourceCode":"\n    public override void Remove(object value)\n    {\n        var index = IndexOf(value);\n        if (index == -1)\n            throw new ArgumentException($\"Parameter {value} not found\");\n        _parameters.RemoveAt(index);\n    }\n\n    public override void RemoveAt(int index)\n    {\n        _parameters.RemoveAt(index);\n    }\n\n    public override void RemoveAt(string parameterName)\n    {\n        var index = IndexOf(parameterName);\n        if (index == -1)\n            throw new ArgumentException($\"Parameter {parameterName} not found\");\n\n        _parameters.RemoveAt(index);\n    }\n\n    protected override DbParameter GetParameter(int index)\n    {\n        return _parameters[index];\n    }\n\n    protected override DbParameter GetParameter(string parameterName)\n    {\n        return _parameters.Find(p => p.ParameterName == parameterName)\n               ?? throw new ArgumentException($\"Parameter {parameterName} not found\");\n    }\n\n    protected override void SetParameter(int index, DbParameter value)\n    {\n        _parameters[index] = value as TursoParameter","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/tursodatabase/turso/blob/244cde92a7df7f9b8b8b7a4075c35a12977e303e/bindings/dotnet/src/Turso.Data/TursoParameterCollection.cs#L77-L113","documentation":"TursoParameterCollection.RemoveAt(string parameterName) throws this ArgumentException when no parameter's ParameterName equals the given name. Matching is exact string equality ('=='), so it is case-sensitive and prefix-sensitive: removing \"id\" when the parameter was added as \"@id\" fails.","triggerScenarios":"Calling RemoveAt(\"id\") for a parameter stored as \"@id\" (or the reverse); case mismatches like RemoveAt(\"@ID\") vs added \"@id\"; removing a parameter twice; removing from the wrong command's collection.","commonSituations":"Inconsistent @-prefix conventions between the code that adds parameters and the code that removes them; refactoring that renamed parameters on one side only; copy-pasted cleanup code between commands with different parameter names.","solutions":["Use the exact name the parameter was added with, including the '@' prefix and casing.","Standardize one naming convention (e.g. always '@name') across add/remove sites.","Guard removals with 'if (cmd.Parameters.IndexOf(name) != -1)' or Contains-style checks."],"exampleFix":"// before\ncmd.Parameters.Add(new TursoParameter(\"@id\", 1));\ncmd.Parameters.RemoveAt(\"id\"); // name mismatch\n\n// after\ncmd.Parameters.RemoveAt(\"@id\");","handlingStrategy":"validation","validationCode":"if (cmd.Parameters.IndexOf(\"@id\") is var i && i != -1)\n    cmd.Parameters.RemoveAt(i);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use one naming convention ('@name') for add and remove sites.","In cleanup code, guard removals with IndexOf."],"tags":["csharp","dotnet","parameters","collection","naming"],"backgroundTag":"parameter-not-found","analyzedSha":"244cde92a7df7f9b8b8b7a4075c35a12977e303e","analyzedAt":"2026-08-20T07:02:18.389Z","contentChangedAt":"2026-08-20T07:02:18.389Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}