{"record":{"id":"6fd778623572c8dc","repo":"crowdsecurity/crowdsec","slug":"unknown-command-s-for-operation-type-s","errorCode":null,"errorMessage":"unknown command '%s' for operation type '%s'","messagePattern":"unknown command '(.+?)' for operation type '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/apiserver/papi_cmd.go","lineNumber":84,"sourceCode":"\t\tdecisions := make([]*models.Decision, 0)\n\n\t\tfor _, deletedDecision := range deletedDecisions {\n\t\t\tlog.Infof(\"Decision from '%s' for '%s' (%s) has been deleted\", deletedDecision.Origin, deletedDecision.Value, deletedDecision.Type)\n\t\t\tdec := &models.Decision{\n\t\t\t\tUUID:     deletedDecision.UUID,\n\t\t\t\tOrigin:   &deletedDecision.Origin,\n\t\t\t\tScenario: &deletedDecision.Scenario,\n\t\t\t\tScope:    &deletedDecision.Scope,\n\t\t\t\tValue:    &deletedDecision.Value,\n\t\t\t\tID:       int64(deletedDecision.ID),\n\t\t\t\tUntil:    deletedDecision.Until.String(),\n\t\t\t\tType:     &deletedDecision.Type,\n\t\t\t}\n\t\t\tdecisions = append(decisions, dec)\n\t\t}\n\t\tp.Channels.DeleteDecisionChannel <- decisions\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown command '%s' for operation type '%s'\", message.Header.OperationCmd, message.Header.OperationType)\n\t}\n\n\treturn nil\n}\n\nfunc AlertCmd(ctx context.Context, message *Message, p *Papi, sync bool) error {\n\tswitch message.Header.OperationCmd {\n\tcase \"add\":\n\t\tdata, err := json.Marshal(message.Data)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\talert := &models.Alert{}\n\n\t\tif err := json.Unmarshal(data, alert); err != nil {\n\t\t\treturn fmt.Errorf(\"message for '%s' contains bad alert format: %w\", message.Header.OperationType, err)\n\t\t}","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/apiserver/papi_cmd.go#L66-L102","documentation":"DecisionCmd dispatches on the message's OperationCmd. When the command is neither of the handled values (e.g. not 'delete'), this error reports the unknown command and operation type. It means PAPI sent an operation this crowdsec version does not understand.","triggerScenarios":"A PAPI message arrives whose Header.OperationCmd is not implemented in the switch — typically a newer server sending a command unknown to this binary.","commonSituations":"Version skew: PAPI/CAPI server newer than the local crowdsec; custom fork sending proprietary commands; corrupted message header.","solutions":["Upgrade crowdsec to a version supporting the new PAPI command","Confirm the sender is a stock crowdsec console/CAPI, not custom tooling","Log the full message header to identify what command is being sent"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"knownCmds := map[string]bool{\"delete\": true}; if !knownCmds[msg.Header.OperationCmd] { /* upgrade or ignore */ }","typeGuard":null,"tryCatchPattern":"if err := DecisionCmd(ctx, msg, p, false); err != nil { if strings.HasPrefix(err.Error(), \"unknown command\") { log.Warnf(\"unsupported PAPI command, consider upgrading: %v\", err) } }","preventionTips":["Upgrade crowdsec when the console introduces new operations","Treat unknown commands as version-skew signals in monitoring","Keep all crowdsec components on the same release train"],"tags":["papi","dispatch","versioning"],"backgroundTag":"unsupported-operation","analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}