{"record":{"id":"822ac7d570588af2","repo":"mattermost-community/focalboard","slug":"invalid-property-value","errorCode":null,"errorMessage":"invalid property value","messagePattern":"invalid property value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/model/properties.go","lineNumber":20,"sourceCode":"// See LICENSE.txt for license information.\n\n//go:generate mockgen -destination=mocks/propValueResolverMock.go -package mocks . PropValueResolver\n\npackage model\n\nimport (\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"strings\"\n\n\t\"github.com/mattermost/focalboard/server/utils\"\n)\n\nvar ErrInvalidBoardBlock = errors.New(\"invalid board block\")\nvar ErrInvalidPropSchema = errors.New(\"invalid property schema\")\nvar ErrInvalidProperty = errors.New(\"invalid property\")\nvar ErrInvalidPropertyValue = errors.New(\"invalid property value\")\nvar ErrInvalidPropertyValueType = errors.New(\"invalid property value type\")\nvar ErrInvalidDate = errors.New(\"invalid date property\")\n\n// PropValueResolver allows PropDef.GetValue to further decode property values, such as\n// looking up usernames from ids.\ntype PropValueResolver interface {\n\tGetUserByID(userID string) (*User, error)\n}\n\n// BlockProperties is a map of Prop's keyed by property id.\ntype BlockProperties map[string]BlockProp\n\n// BlockProp represent a property attached to a block (typically a card).\ntype BlockProp struct {\n\tID    string `json:\"id\"`\n\tIndex int    `json:\"index\"`\n\tName  string `json:\"name\"`\n\tValue string `json:\"value\"`","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/mattermost-community/focalboard/blob/a84bbb65e32edf972856b329417096ac413518e9/server/model/properties.go#L2-L38","documentation":"ErrInvalidPropertyValue means a stored property value cannot be interpreted according to its property definition, e.g. a select value that is not among the declared options. GetPropertyString and GetValue return it when decoding the raw value fails. It guards against silently rendering meaningless data.","triggerScenarios":"Calling GetValue/GetPropertyString where the raw value does not match the PropDef type's expected shape (e.g. select option id not present in options list, malformed multi-select value, unparseable person/date value).","commonSituations":"Values written by an older client version, values copied from a board whose options differ, direct DB edits, or imports from other tools writing raw strings instead of option ids.","solutions":["Reset the card's property value to a valid option (or empty) via the UI or API.","Update the board's property definition options to include the stored value's id.","Check that the value format matches the property type before writing via the API.","Handle the error gracefully on read: treat invalid values as blank and log for cleanup."],"exampleFix":"// before: writing a raw label instead of an option id\nprops[\"status\"] = \"Done\"\n// after: write the option id from the schema\nprops[\"status\"] = board.CardProperties[\"status\"].Options[1].ID","handlingStrategy":"validation","validationCode":"func isValidPropValue(def model.PropDef, value interface{}) bool {\n    switch def.Type {\n    case \"select\":\n        s, _ := value.(string)\n        for _, o := range def.Options {\n            if o.ID == s {\n                return true\n            }\n        }\n        return false\n    }\n    return true\n}","typeGuard":"func isKnownOption(def model.PropDef, optionID string) bool {\n    for _, o := range def.Options {\n        if o.ID == optionID {\n            return true\n        }\n    }\n    return false\n}","tryCatchPattern":"val, err := GetValue(resolver, board, props, key)\nif errors.Is(err, model.ErrInvalidPropertyValue) {\n    log.Warn(\"stale property value; treating as empty\", \"key\", key)\n    val = \"\"\n}","preventionTips":["Write option IDs (not labels) for select properties.","Keep option lists consistent across boards you copy cards between.","Add cleanup jobs for values orphaned by option deletion."],"tags":["go","properties","data-validation"],"backgroundTag":"invalid-property-value","analyzedSha":"a84bbb65e32edf972856b329417096ac413518e9","analyzedAt":"2026-08-30T09:22:20.720Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}