# Buggy code
def determine_target_prefix(ctx, args=None):
    """Get the prefix to operate in.  The prefix may not yet exist.

    Args:
        ctx: the context of conda
        args: the argparse args from the command line

    Returns: the prefix
    Raises: CondaEnvironmentNotFoundError if the prefix is invalid
    """

    argparse_args = args or ctx._argparse_args
    try:
        prefix_name = argparse_args.name
    except AttributeError:
        prefix_name = None
    try:
        prefix_path = argparse_args.prefix
    except AttributeError:
        prefix_path = None

    if prefix_name is None and prefix_path is None:
        return ctx.default_prefix
    elif prefix_path is not None:
        return expand(prefix_path)
    else:
        if "/" in prefix_name:
            from ..exceptions import CondaValueError

            raise CondaValueError(
                "'/' not allowed in environment name: %s" % prefix_name
            )
        if prefix_name in (ROOT_ENV_NAME, "root"):
            return ctx.root_prefix
        else:
            from ..exceptions import EnvironmentNameNotFound

            try:
                return locate_prefix_by_name(prefix_name)
            except EnvironmentNameNotFound:
                return join(_first_writable_envs_dir(), prefix_name)


# Traceback (AssertionError)
error: AssertionError()
command: /Users/cpthgli/.anyenv/envs/pyenv/versions/default/bin/conda update --name  --all --yes
user_agent: conda/4.4.4 requests/2.18.4 CPython/3.6.4 Darwin/17.3.0 OSX/10.13.2
_messageid: -9223372036843525540
_messagetime: 1514462637935 / 2017-12-28 06:03:57

Traceback (most recent call last):
File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/exceptions.py", line 724, in __call__
return func(*args, **kwargs)
File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main
exit_code = do_call(args, p)
File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 75, in do_call
exit_code = getattr(module, func_name)(args, parser)
File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/cli/main_update.py", line 14, in execute
install(args, parser, 'update')
File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/cli/install.py", line 140, in install
prefix = context.target_prefix
File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/base/context.py", line 454, in target_prefix
return determine_target_prefix(self)
File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/base/context.py", line 974, in determine_target_prefix
return locate_prefix_by_name(prefix_name)
File "/Users/cpthgli/.anyenv/envs/pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/conda/base/context.py", line 923, in locate_prefix_by_name
assert name
AssertionError

# Fixed code
def determine_target_prefix(ctx, args=None):
    """Get the prefix to operate in.  The prefix may not yet exist.

    Args:
        ctx: the context of conda
        args: the argparse args from the command line

    Returns: the prefix
    Raises: CondaEnvironmentNotFoundError if the prefix is invalid
    """

    argparse_args = args or ctx._argparse_args
    try:
        prefix_name = argparse_args.name
    except AttributeError:
        prefix_name = None
    try:
        prefix_path = argparse_args.prefix
    except AttributeError:
        prefix_path = None

    if prefix_name is not None and not prefix_name.strip():  # pragma: no cover
        from ..exceptions import ArgumentError

        raise ArgumentError("Argument --name requires a value.")

    if prefix_path is not None and not prefix_path.strip():  # pragma: no cover
        from ..exceptions import ArgumentError

        raise ArgumentError("Argument --prefix requires a value.")

    if prefix_name is None and prefix_path is None:
        return ctx.default_prefix
    elif prefix_path is not None:
        return expand(prefix_path)
    else:
        if "/" in prefix_name:
            from ..exceptions import CondaValueError

            raise CondaValueError(
                "'/' not allowed in environment name: %s" % prefix_name
            )
        if prefix_name in (ROOT_ENV_NAME, "root"):
            return ctx.root_prefix
        else:
            from ..exceptions import EnvironmentNameNotFound

            try:
                return locate_prefix_by_name(prefix_name)
            except EnvironmentNameNotFound:
                return join(_first_writable_envs_dir(), prefix_name)