Skip to content

Error handling

Tommaso Ornato edited this page Sep 7, 2023 · 11 revisions

The AutoMod has several built in error handlers with custom error messages to simplify the troubleshooting process.

All of the following messages are possible answers that a moderator might receive after having attempted to add a new AutoMod rule, by sending a message to the bot.

Error messages

Incorrect schema

The schema of one or more of the submitted configurations doesn't match any of the expected JSON schemas. This is likely caused by an error on your end while configuring the AutoMod. Make sure to double check the rule you are trying to write, compare it to the many examples presented in this wiki and the expected JSON schema found within this repository.

To help you fix this error you can also add a $schema proprety to your rule and use either Visual Studio Code or the online editor to validate it. Add one of the following lines to your rule, in accordance with the rule field you are trying to set:

Comment:

{
    "$schema": "https://raw.githubusercontent.com/ornato-t/lemmy-automoderator/master/src/schemas/comment.json",
    "rule": "comment",
    [...]
}

Post:

{
    "$schema": "https://raw.githubusercontent.com/ornato-t/lemmy-automoderator/master/src/schemas/post.json",
    "rule": "post",
    [...]
}

Exception:

{
    "$schema": "https://raw.githubusercontent.com/ornato-t/lemmy-automoderator/master/src/schemas/exception.json",
    "rule": "exception",
    [...]
}

Mention:

{
    "$schema": "https://raw.githubusercontent.com/ornato-t/lemmy-automoderator/master/src/schemas/mention.json",
    "rule": "mention",
    [...]
}

Community not found

The community for which you are trying to add a rule doesn't exist on the local instance. This might be either because it does exist but it's hosted on a different instance or because you are writing its name incorrectly.

The "community" field should be filled with the name of a community, not its displayed_name. In other words, for the community displayed in this picture you should write "lemmy_support", not "Lemmy Support".

immagine

You are not a moderator

Only moderators may specify AutoMod rules.

  • If you are a mod you probably have made a mistake in the "community" field and are trying to change the configuration of a community that does exist but where you are not a mod.
  • If you are an admin you still can't change the rules of a community, unless you also become a mod in said community
  • If you are neither a mod nor an admin what the hell were you thinking?

AutoMod is not a moderator

In its current pre-release version, the AutoMod has to be manually added to a community's mod team. This means that you have to manually write a comment in the target community with the AutoMod's account, appoint it as a mod with your admin/mod and then you'll be able to configure it.

This process will be automated in future releases of the bot.

Error while processing AutoMod configuration

This is a generic error not necessarily caused by an error in your configuration. If a similar error is encountered feel free to reach out to me by opening an issue. Make sure to include the full error message in your report.

Error handling with multiple rules

If the provided configuration is an array of rules, as explained in the Inserting multiple rules page, each rule will be treated singularly for the purposes of error handling.

If an array containing some correctly formatted rules and some incorrectly formatted rules is presented, the correctly formatted ones will be inserted, while the faulty ones will not. If all rules are incorrectly formatted no rules will be inserted.

The bot will point out which rules are incorrect, specifying what's wrong with each one of them.

Example: suppose you were a moderator of c/general and wanted to whitelist two users: Bob and Alice. You enter the following configuration:

[
    {
        "rule": "exception",
        "user_actor_id": "https://lemmy.ml/u/Bob",
        "community": "general"
    },
    {
        "rule": "exception",
        "user_actor_id": "https://lemmy.ml/u/Alice",
        "community": "geeneral"
    }
]

the second rule is incorrect, because the community you are moderating is called "general", not "geeneral".
The bot will reply as follows:

Rules partially added. Some of the provided configurations were invalid. Make sure to consult the bot's documentation to avoid any mistakes.

The remaining rules were succesfully added.

Errors:

  • Rule 2: No community named "geeneral" was found.