{"record":{"id":"1d33168c4f4e7e9d","repo":"theonedev/onedev","slug":"missing-issue-field-fieldspecname","errorCode":null,"errorMessage":"Missing issue field: ${fieldSpecName}","messagePattern":"Missing issue field: (.+?)","errorType":"validation","errorClass":"ValidationException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/model/support/issue/field/FieldUtils.java","lineNumber":188,"sourceCode":"\t\ttry {\n\t\t\tfieldSpec.convertToObject(fieldValue);\n\t\t} catch (Exception e) {\n\t\t\tString displayValue;\n\t\t\tif (fieldSpec instanceof SecretField)\n\t\t\t\tdisplayValue = SecretInput.MASK;\n\t\t\telse\n\t\t\t\tdisplayValue = fieldValue.toString();\n\t\t\tif (e.getMessage() == null)\n\t\t\t\tlogger.error(\"Error validating field value\", e);\n\t\t\tthrow new ValidationException(\"Error validating value '\" + displayValue + \"' of field '\" \n\t\t\t\t\t+ fieldName + \"': \" + e.getMessage());\n\t\t}\n\t}\n\n\tprivate static void validateFieldNames(Collection<String> fieldSpecNames, Collection<String> fieldNames) {\n\t\tfor (String fieldSpecName: fieldSpecNames) {\n\t\t\tif (!fieldNames.contains(fieldSpecName))\n\t\t\t\tthrow new ValidationException(\"Missing issue field: \" + fieldSpecName);\n\t\t}\n\t\tfor (String fieldName: fieldNames) {\n\t\t\tif (!fieldSpecNames.contains(fieldName))\n\t\t\t\tthrow new ValidationException(\"Unknown issue field: \" + fieldName);\n\t\t}\n\t}\n\t\n\tpublic static void validateFieldMap(Map<String, FieldSpec> fieldSpecMap, Map<String, List<String>> fieldMap) {\n\t\tvalidateFieldNames(fieldSpecMap.keySet(), fieldMap.keySet());\n\t\tfor (Map.Entry<String, List<String>> entry: fieldMap.entrySet()) {\n\t\t\tif (entry.getValue() != null) {\n\t\t\t\tFieldSpec fieldSpec = Preconditions.checkNotNull(fieldSpecMap.get(entry.getKey()));\n\t\t\t\tvalidateFieldValue(fieldSpec, entry.getKey(), entry.getValue());\n\t\t\t}\n\t\t}\n\t}\n\t\n\tpublic static void validateFields(Map<String, FieldSpec> fieldSpecs, List<FieldInstance> fields) {","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/model/support/issue/field/FieldUtils.java#L170-L206","documentation":"validateFieldNames compares the set of defined field specs with the supplied field names. If a required field spec has no corresponding entry in the supplied map, ValidationException 'Missing issue field: <name>' is thrown.","triggerScenarios":"Submitting an issue field map that omits a mandatory custom field defined for the project, e.g. creating/updating an issue via API or transition without providing a required field.","commonSituations":"New required fields added to a project after automation scripts were written; form submissions missing fields hidden by condition logic; bulk imports skipping required fields.","solutions":["Add the named field to the submitted field map with a valid value","Relax the field's 'required' flag in issue settings if it should be optional","Check field specs of the target project before submission and include all of them"],"exampleFix":"// before\nfieldMap = Map.of(\"Priority\", List.of(\"High\"));\n// after\nfieldMap = Map.of(\"Priority\", List.of(\"High\"), \"Severity\", List.of(\"Major\"));","handlingStrategy":"validation","validationCode":"Set<String> specNames = fieldSpecMap.keySet();\nSet<String> provided = fieldMap.keySet();\nSet<String> missing = new HashSet<>(specNames);\nmissing.removeAll(provided);\nif (!missing.isEmpty()) throw new IllegalStateException(\"Missing: \" + missing);","typeGuard":null,"tryCatchPattern":"try {\n    FieldUtils.validateFieldMap(fieldSpecMap, fieldMap);\n} catch (ValidationException e) {\n    if (e.getMessage().startsWith(\"Missing issue field\"))\n        fieldMap.put(extractFieldName(e.getMessage()), defaultValue);\n}","preventionTips":["Include every required field spec in payloads, even when unchanged","Re-sync scripts whenever a field is made required","Enumerate required specs dynamically instead of hardcoding field lists"],"tags":["issue-fields","validation","required-field"],"backgroundTag":"missing-required-argument","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}