{"record":{"id":"374d8e2013577b1c","repo":"slint-ui/slint","slug":"first-argument-not-an-array","errorCode":null,"errorMessage":"First argument not an array: {:?}","messagePattern":"First argument not an array: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/interpreter/eval.rs","lineNumber":2193,"sourceCode":"            };\n            let value = eval_expression(ctx, &arguments[1]);\n\n            i_slint_core::model::report_model_error(\n                \"push\",\n                log_message_location(source_location),\n                model.push_row(value),\n            );\n\n            Value::Void\n        }\n        BuiltinFunction::ArrayRemove => {\n            if arguments.len() != 2 {\n                panic!(\"internal error: incorrect argument count to ArrayRemove\")\n            }\n\n            let model = match eval_expression(ctx, &arguments[0]) {\n                Value::Model(m) => m,\n                _ => panic!(\"First argument not an array: {:?}\", arguments[0]),\n            };\n            let index = match eval_expression(ctx, &arguments[1]) {\n                Value::Number(i) => i,\n                _ => panic!(\"Second argument not an integer: {:?}\", arguments[1]),\n            };\n\n            let result = match usize::try_from(index as i64) {\n                Ok(index) => model.remove_row(index),\n                Err(_) => Err(i_slint_core::model::ModelError::out_of_bounds(model.row_count())),\n            };\n            i_slint_core::model::report_model_error(\n                \"remove\",\n                log_message_location(source_location),\n                result,\n            );\n\n            Value::Void\n        }","sourceCodeStart":2175,"sourceCodeEnd":2211,"githubUrl":"https://github.com/slint-ui/slint/blob/3a7e700487dc74d404cad0726378053ab763d4e0/internal/interpreter/eval.rs#L2175-L2211","documentation":"The interpreter's builtin ArrayRemove function requires its first argument to evaluate to a Value::Model (an array). If the evaluated first argument is any other Value kind (number, string, struct, etc.), the interpreter panics. There is no dynamic coercion to arrays in Slint's type system.","triggerScenarios":"Calling `ArrayRemove(x, i)` from .slint code where x is not an array/model-typed expression — e.g. passing a struct, a plain value, or a property that was expected to be an array but is a different type.","commonSituations":"Type errors in .slint scripts that the interpreter catches only at runtime; a property declared without array type but used with array builtins; refactoring that changed a property from an array to a scalar while call sites remained.","solutions":["Declare the first argument's property/parameter with an explicit array type, e.g. `property<[int]> items;` or `property<[MyStruct]> list;`","Fix the call site so a genuine array is passed to ArrayRemove","Check the .slint source at runtime with a type-aware editor or the LSP to catch the type mismatch statically before running"],"exampleFix":"// before (.slint)\nproperty<int> count;\nArrayRemove(count, index); // panics\n// after\nproperty<[int]> items;\nArrayRemove(items, index);","handlingStrategy":"type-guard","validationCode":"// .slint: declare the argument as an array type\nproperty<[int]> items; // ArrayRemove(items, i) is valid","typeGuard":"// .slint has no runtime type guard; enforce statically by typing the property:\n// property<[T]> items; and only pass properties of type [T] to ArrayRemove","tryCatchPattern":null,"preventionTips":["Give all properties passed to array builtins explicit array types in .slint","Use the Slint LSP to surface type errors at authoring time","When changing a property's type, grep for all builtin-function call sites using it"],"tags":["interpreter","slint","type-mismatch","builtin-function"],"backgroundTag":"type-mismatch","analyzedSha":"3a7e700487dc74d404cad0726378053ab763d4e0","analyzedAt":"2026-09-16T01:37:20.251Z","contentChangedAt":"2026-09-16T01:37:20.251Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}