# Buggy code
async def _repo_add(self, ctx, name: str, repo_url: str, branch: str = None):
    """Add a new repo.

    The name can only contain characters A-z, numbers and underscores.
    The branch will be the default branch if not specified.
    """
    agreed = await do_install_agreement(ctx)
    if not agreed:
        return
    try:
        # noinspection PyTypeChecker
        repo = await self._repo_manager.add_repo(name=name, url=repo_url, branch=branch)
    except errors.ExistingGitRepo:
        await ctx.send(_("That git repo has already been added under another name."))
    except errors.CloningError as err:
        await ctx.send(_("Something went wrong during the cloning process."))
        log.exception(
            "Something went wrong whilst cloning %s (to revision: %s)",
            repo_url,
            branch,
            exc_info=err,
        )
    else:
        await ctx.send(_("Repo `{name}` successfully added.").format(name=name))
        if repo.install_msg is not None:
            await ctx.send(repo.install_msg.replace("[p]", ctx.prefix))


# Traceback (NotADirectoryError)
[2019-09-14 10:39:30] [ERROR] red: Exception in command 'repo add'
Traceback (most recent call last):
File "<VENV>\lib\site-packages\redbot\cogs\downloader\downloader.py", line 233, in _repo_add
repo = await self._repo_manager.add_repo(name=name, url=repo_url, branch=branch)
File "<VENV>\lib\site-packages\redbot\cogs\downloader\repo_manager.py", line 586, in add_repo
r = Repo(url=url, name=name, branch=branch, folder_path=self.repos_folder / name)
File "<VENV>\lib\site-packages\redbot\cogs\downloader\repo_manager.py", line 66, in __init__
self.folder_path.mkdir(parents=True, exist_ok=True)
File "<Python>\lib\pathlib.py", line 1241, in mkdir
self._accessor.mkdir(self, mode)
NotADirectoryError: [WinError 267] The directory name is invalid: '<datapath>\\cogs\\RepoManager\\repos\\:'

# Fixed code
async def _repo_add(self, ctx, name: str, repo_url: str, branch: str = None):
    """Add a new repo.

    Repo names can only contain characters A-z, numbers, underscores, and hyphens.
    The branch will be the default branch if not specified.
    """
    agreed = await do_install_agreement(ctx)
    if not agreed:
        return
    if re.match("^[a-zA-Z0-9_\-]*$", name) is None:
        await ctx.send(
            _(
                "Repo names can only contain characters A-z, numbers, underscores, and hyphens."
            )
        )
        return
    try:
        # noinspection PyTypeChecker
        repo = await self._repo_manager.add_repo(name=name, url=repo_url, branch=branch)
    except errors.ExistingGitRepo:
        await ctx.send(_("That git repo has already been added under another name."))
    except errors.CloningError as err:
        await ctx.send(_("Something went wrong during the cloning process."))
        log.exception(
            "Something went wrong whilst cloning %s (to revision: %s)",
            repo_url,
            branch,
            exc_info=err,
        )
    except OSError:
        await ctx.send(
            _(
                "Something went wrong trying to add that repo. Your repo name might have an invalid character."
            )
        )
    else:
        await ctx.send(_("Repo `{name}` successfully added.").format(name=name))
        if repo.install_msg is not None:
            await ctx.send(repo.install_msg.replace("[p]", ctx.prefix))